-
-
Notifications
You must be signed in to change notification settings - Fork 32
Open
Labels
questionFurther information is requestedFurther information is requested
Description
Hello,
I recently picked this up to try to deserialize TOML, however, I am having trouble with deserializing into custom types.
I have this current setup, trying to deserialize an array into a Vector3
:
TomlModelOptions op = new TomlModelOptions();
op.ConvertToModel = (o, toType) =>
{
Console.WriteLine(toType);
if (toType == typeof(DateTime)) return new DateTime();
if (o.GetType() == typeof(List<>) && toType == typeof(Vector3)) return new Vector3();
return null;
};
Toml.ToModel<PrimitiveModelData>(File.ReadAllText(tomlFile), options: op);
however, I end up getting an error when i try to deserialize, stating: Invalid list type OpenTK.Mathematics.Vector3. Getting a StandardObjectDynamicAccessor Type: OpenTK.Mathematics.Vector3 instead.
My toml file is simply
[[cubes]]
start = [0, 0, 0]
Note that it does work for DateTime
(Console.WriteLine
prints), but doesn't work for the custom type. How could I fix this? Thanks.
Metadata
Metadata
Assignees
Labels
questionFurther information is requestedFurther information is requested