there is no way I haven’t find a way to determine the size of a .NET managed object in memory.
The closest I can come out, particularly for a DataSet object is as follows:
DataSet ds = new DataSet(); // ... // This is where you populate the content of DataSet // ... String xmlContent = ds.GetXml(); UnicodeEncoding uniEnc = new UnicodeEncoding(); int byteCount = uniEnc.GetByteCount(xmlContent);
But why we use UnicodeEncoding, not ASCIIEncoding, or UTF8Encoding, well, as MSDN says, String object is a collection of Unicode characters. So if we want to know how many bytes are they, we need to use UnicodeEncoding.
Of course we are still far from our actual objective, but this is a good start. I’ll update as I found other possible method.
a WordPress rating system