/// <summary>
/// Serializes this class to a json string.
/// </summary>
/// <returns>A JSON string reprsenting a SelectListItem.</returns>
public string ToJson()
{
using (var memoryStream = new MemoryStream())
{
var dataContractJsonSerializer = new DataContractJsonSerializer(typeof(JsonSerializableSelectListItem));
dataContractJsonSerializer.WriteObject(memoryStream, this);
memoryStream.Position = 0;
using (var streamReader = new StreamReader(memoryStream))
{
return streamReader.ReadToEnd();
}
}
}
Thursday, 15 November 2012
Deep clone of an object by rewinding the Serialization stream
Subscribe to:
Post Comments (Atom)
How to find the last interactive logons in Windows using PowerShell
Use the following powershell script to find the last users to login to a box since a given date, in this case the 21st April 2022 at 12pm un...
-
Example... Add this to your controls namespace declarations xmlns:MyNameSpace="clr-namespace:MyNameSpace;assembly=MyAssembly" t...
-
http://www.jaguarforums.com/forum/s-type-s-type-r-supercharged-v8-15/key-fob-battery-replacement-write-up-faq-54380/ NOTE: MAKE SURE YOU DO ...
No comments:
Post a Comment