Platinum Partner

Get any object size in kb

public static int GetObjSize(Object obj)
        {
            try
            {
                string XmlString = string.Empty;
                MemoryStream MemStream = new MemoryStream();
                XmlSerializer Serializer = new XmlSerializer(obj.GetType());
                XmlTextWriter XmlText = new XmlTextWriter(MemStream, Encoding.Default);
                Serializer.Serialize(XmlText, obj);
                byte[] bytes = new byte[] { };
                bytes = MemStream.ToArray();
                XmlString = Encoding.Default.GetString(bytes, 0, bytes.Length);
                MemStream.Flush();
                MemStream.Close();
                XmlText.Flush();
                XmlText.Close();

                byte[] bytesobj = new byte[XmlString.Length * sizeof(char)];
                Buffer.BlockCopy(XmlString.ToCharArray(), 0, bytes, 0, bytes.Length);
                return bytesobj.Length;
            }
            catch (Exception e)
            {
                return -1;
            }
        }
{{ tag }}, {{tag}},

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}
{{ parent.authors[0].realName || parent.author}}

{{ parent.authors[0].tagline || parent.tagline }}

{{ parent.views }} ViewsClicks
Tweet

{{parent.nComments}}