I'm in the process of developing an application which uses the leap motion device and to be implemented using C#, my problem is that i want to store the list which contains the Vectors in my database. So i have thought about a solution of transforming the vector into an array of floats the problem is that each list contains a maximum and a minimum of 300 values (storing that into the database takes a load of time).
So i've search for other possible ways of storing and i ended up onto the topic of .net serialization. I had tried implementing the built-in .net serialization. Thought it worked, but still again it will took about a minute of serializing the list. So another solution proposed on the topic is to use the protobuf-net. so i'd tried and installed it using the nuget package installer. And ended up with this function (copied from the solution Fastest way to serialize and deserialize .NET objects)
public static byte[] Serialize(List<Vector> tData)
{
using (var ms = new MemoryStream())
{
ProtoBuf.Serializer.Serialize(ms, tData);
return ms.ToArray();
}
}
public static List<Vector> Deserialize(byte[] tData)
{
using (var ms = new MemoryStream(tData))
{
return ProtoBuf.Serializer.Deserialize<List<Vector>>(ms);
}
}
But running the code will lead me to the error stated above(the title).
I think the error will happen at: ProtoBuf.Serializer.Serialize(ms, tData);