Tuesday, 12 April 2016

Serialize CRM Object

namespace ConsoleApplication6
{
    class Program
    {
        static void Main(string[] args)
        {
            Microsoft.Xrm.Sdk.Entity E = new Microsoft.Xrm.Sdk.Entity("entity");
            System.Runtime.Serialization.DataContractSerializer Sz =
                new System.Runtime.Serialization.DataContractSerializer(typeof(Microsoft.Xrm.Sdk.Entity));
            StringBuilder sb = new StringBuilder();
            System.IO.MemoryStream ms = new System.IO.MemoryStream();
            Sz.WriteObject(ms, E);
            string str = Encoding.ASCII.GetString(ms.ToArray());
        }
    }
}

No comments:

Post a Comment