Sunday, November 16, 2014

Another Methord used to create Xml By Passing the Object

  /// <summary>
        /// Methord used to create Xml By Passing the Object
        /// </summary>
        /// <param name="obj"></param>
        /// <returns></returns>
        public static XmlDocument ObjectTOXml(object obj, int val)
        {
            XmlSerializer serializer = new XmlSerializer(obj.GetType());
            MemoryStream msXml = new MemoryStream();
            XmlDocument xDoc = new XmlDocument();
            serializer.Serialize(msXml, obj);
            msXml.Position = 0;
            xDoc.Load(msXml);
            msXml.Close();
            return xDoc;
        }

No comments:

Using Authorization with Swagger in ASP.NET Core

 Create Solution like below LoginModel.cs using System.ComponentModel.DataAnnotations; namespace UsingAuthorizationWithSwagger.Models {     ...