object to byte not working
<p>I am trying to convert class to byte but not worked.</p>

<p>I receive a byte[] (b) with zero length . why ?</p>

<pre><code>void start()
{

    Item item = new Item();
    item.files.Add(@"test");
    byte[] b = ObjectToByteArray(item);  // b will have zero length 

}


    [Serializable]
    public class Item : ISerializable
    {
        public Item()
        {
            files = new List&lt;string&gt;();
            Exclude = false;
            CleanEmptyFolder = false;
        }
        public List&lt;string&gt; files;
        public string MusicProfileName;
        public bool Exclude;

        #region ISerializable Members

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            info.AddValue("files", files);
            info.AddValue("MusicProfileName", MusicProfileName);
            info.AddValue("Exclude", Exclude);
        }

        #endregion
    }

    public byte[] ObjectToByteArray(object _Object)
    {
        using (var stream = new MemoryStream())
        {
            // serialize object 
            var formatter = new BinaryFormatter();
            formatter.Serialize(stream, _Object);

            // get a byte array
            var bytes = new byte[stream.Length];
            using (BinaryReader br = new BinaryReader(stream))
            {
                bytes = br.ReadBytes(Convert.ToInt32(stream.Length));
            }

            return bytes;
        }

    }
</code></pre>
