public virtual string Serialize()
{
StreamReader streamReader = null;
MemoryStream memoryStream = null;
try
{
memoryStream = new MemoryStream();
Serializer.Serialize(memoryStream, this);
memoryStream.Seek(0, SeekOrigin.Begin);
streamReader = new StreamReader(memoryStream);
return streamReader.ReadToEnd();
}
finally
{
if ((streamReader != null))
{
streamReader.Dispose();
}
if ((memoryStream != null))
{
memoryStream.Dispose();
}
}
}