I have a List that I’m converting to a byte[] like so:
List<int> integerList = new List<int>();
integerList.Add(1);
integerList.Add(2);
integerList.Add(3);
byte[] bytes = integerList.SelectMany(BitConverter.GetBytes).ToArray();
How do I convert this back to a List?
One of the many ways to do it (a LINQ one):
Minor update:
You can also write a handy generic version of this (just in case you’ll need to work with other types):
Usage: