Network C#

using System;
using System.Data;
using System.Configuration;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Runtime.Serialization;
using System.IO;
using System.Text;
using System.Runtime.Serialization.Json;
  public static class Common
  {
    public static string Serialize(this object collection)
    {
      DataContractJsonSerializer serializer = new DataContractJsonSerializer(collection.GetType());
      using (MemoryStream s = new MemoryStream())
      {
        serializer.WriteObject(s, collection);
        return Encoding.UTF8.GetString(s.GetBuffer());
      }
    }
  }