public override Vector3 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
ReadOnlyMemory<char> vectorString = reader.GetString().AsMemory();
var vectorValues = vectorString.Split(',').Select(s => float.Parse(s)).ToArray(); // Unable to parse `s` as it's not a string. What do?
return new Vector3 { X = vectorValues[0], Y = vectorValues[1], Z = vectorValues[2] };
}
public override Vector3 Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
ReadOnlyMemory<char> vectorString = reader.GetString().AsMemory();
var vectorValues = vectorString.Split(',').Select(s => float.Parse(s)).ToArray(); // Unable to parse `s` as it's not a string. What do?
return new Vector3 { X = vectorValues[0], Y = vectorValues[1], Z = vectorValues[2] };
}