In C# how can I serialize a List<int> to a byte[] in order to store it in a DB field?
- by Matt
In C# how can I serialize a List to a byte[] in order to store it in a DB field?
I know how to serialize to a file on the disk, but how do I just serialize to a variable?
Here is how I serialized to the disk:
List<int> l = IenumerableofInts.ToList();
Stream s = File.OpenWrite("file.bin");
BinaryFormatter bf = new BinaryFormatter();
bf.Serialize(s, lR);
s.Close();
I'm sure it's much the same but I just can't wrap my head around it.