Deserialize XML string

Use this following static method to convert any xml to its object representation 

public static object ToObject(Type objectType, string xml)

{

  object obj = null;

  try

  {

    XmlSerializer xs = new XmlSerializer(objectType);

    obj = xs.Deserialize(new StringReader(xml));

  }

  catch (Exception ex)

  {

  }

  return obj;

}

Advertisements