Xml veriyi Class’a Atama
public static T SetXmlDataToViewModel<T>(T oViewModel, string xmlData) { if (string.IsNullOrEmpty(xmlData)) { return oViewModel; } XDocument dataXmlDoc = XDocument.Parse(xmlData); foreach (var prop in typeof(T).GetProperties()) { if (dataXmlDoc.Descendants().SingleOrDefault(p => p.Name.LocalName == prop.Name) != null) prop.SetValue(oViewModel, Convert.ChangeType(dataXmlDoc.Descendants().SingleOrDefault(p => p.Name.LocalName == prop.Name).Value, prop.PropertyType)); } return oViewModel; }