Tuesday, 11 November 2014

Convert XML Values to the Custom object in C#

 string strXML = System.IO.File.ReadAllText(@"Path...\Desktop\test.xml");
            var customObjectXml = new CustomObject();
            XmlSerializer oXmlSerializer = new XmlSerializer(customObjectXml.GetType());
            //The StringReader will be the stream holder for the existing XML file
            customObjectXml = (CustomObject)oXmlSerializer.Deserialize(new StringReader(strXML));

This is the simple code we can use to convert the xml related values to Custom .NET object.
This code is getting the XML from the path and converting to Custom Object by using the XMLSerializer and the Deserializer.  If it is not working properly we have to compare the XML values and custom object XmlRoot and XmlType

[XmlRoot("NewGroupName")]
[XmlType("NewTypeName")]
[XmlAttribute("href")]

Wednesday, 7 May 2014

Visual Studio Versions

Visual Studio Versions:
  • In 2002, all projects use .Net 1.0
  • In 2003, all projects use .Net 1.1
  • In 2005, all projects use .Net 2.0
  • In 2008, projects use .Net 2.0, 3.0, or 3.5; you can change the version in Project Properties
  • In 2010, projects use .Net 2.0, 3.0, 3.5, or 4.0; you can change the version in Project Properties
  • In 2012, projects use .Net 2.0, 3.0, 3.5, 4.0 or 4.5; you can change the version in Project Properties