Friday, March 13, 2009

how to get the size of a byte array in C#

System.IO.MemoryStream stream = new System.IO.MemoryStream();

System.Runtime.Serialization.Formatters.Binary.BinaryFormatter objFormatter = new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
objFormatter.Serialize(stream, byData);
long size = stream.Length;

No comments: