Is there any way to find the size of a data which i am sending to webservice from the client in Csharp dotnet
A:
Here's a way to find the size of your data when it's serialized to XML, which is what happens when you call a standard SOAP webservice:
var data = GetMyData();
var serializer = new XmlSerializer(data.GetType())
using(var stream = new MemoryStream())
{
serializer.Serialize(stream, data);
var sizeOfData = stream.Length;
}
Xoltar
2010-01-30 03:54:26
-1 for not placing the `MemoryStream` into a `using` block. I'll remove the downvote if you'll fix that.
John Saunders
2010-01-30 04:28:33
Added the using block as requested...
Xoltar
2010-01-30 17:20:45