try { return GetValue(e, "array", nodeName); } catch { return string.Empty; } } public static string GetString(this XElement e, string nodeName) { try { return GetValue(e, "str", nodeName); } catch { return string.Empty; } } public static string GetText(this XElement e, string nodeName) { try { return GetValue(e, "text", nodeName); } catch { return string.Empty; } } public static DateTime GetDate(this XElement e, string nodeName) { try { return DateTime.Parse(GetValue(e, "date", nodeName)); } catch { return default(DateTime); } } public static DateTime? GetDateOrNull(this XElement e, string nodeName) { try { return DateTime.Parse(GetValue(e, "date", nodeName)); } catch { return null; } } public static bool GetBoolean(this XElement e, string nodeName) { try { return bool.Parse(GetValue(e, "boolean", nodeName)); } catch { return default(bool); } } public static bool? GetBooleanOrNull(this XElement e, string nodeName) { try { return bool.Parse(GetValue(e, "boolean", nodeName)); } catch { return null; } } public static short GetShort(this XElement e, string nodeName) { try { return short.Parse(GetValue(e, "short", nodeName)); } catch { return default(short); } } public static short? GetShortOrNull(this XElement e, string nodeName) { try { return short.Parse(GetValue(e, "short", nodeName)); } catch { return null; } } public static int GetInt(this XElement e, string nodeName) { try { return int.Parse(GetValue(e, "int", nodeName)); } catch { return default(short); } } public static int? GetIntOrNull(this XElement e, string nodeName) { try { return int.Parse(GetValue(e, "int", nodeName)); } catch { return null; } } public static long GetLong(this XElement e, string nodeName) { try { return short.Parse(GetValue(e, "long", nodeName)); } catch { return default(long); } } public static long? GetLongOrNull(this XElement e, string nodeName) { try { return long.Parse(GetValue(e, "long", nodeName)); } catch { return null; } } public static decimal GetDecimal(this XElement e, string nodeName) { try { return decimal.Parse(GetValue(e, "decimal", nodeName)); } catch { return default(decimal); } } public static decimal? GetDecimalOrNull(this XElement e, string nodeName) { try { return decimal.Parse(GetValue(e, "decimal", nodeName)); } catch { return null; } } public static double GetDouble(this XElement e, string nodeName) { try { return double.Parse(GetValue(e, "double", nodeName)); } catch { return default(double); } } public static double? GetDoubleOrNull(this XElement e, string nodeName) { try { return double.Parse(GetValue(e, "double", nodeName)); } catch { return null; } } public static float GetFloat(this XElement e, string nodeName) { try { return float.Parse(GetValue(e, "float", nodeName)); } catch { return default(float); } } public static float? GetFloatOrNull(this XElement e, string nodeName) { try { return float.Parse(GetValue(e, "float", nodeName)); } catch { return null; } } private static string GetValue(XElement e, string elementName, string nodeName) { return e.Elements(elementName).First(s => s.Attribute("name").Value.Equals(nodeName)).Value; } }}The XML employee sample employee#2008-09.001 Marco Antonio Almeida marcominas@hotmail.com 2008-09-01T00:00:00Z Rua Lourenco Vanucci Jardim Guaruja Sorocaba-SP 1 1234.56 first skill second skill The solr parser classusing System;using System.Collections.Generic;using System.Linq;using System.Text;using System.Reflection;using System.Xml.Linq;namespace mmcSolutions.SolrParser{ /// /// /// public class ResultParser { /// /// /// /// /// /// public static T Parse(String xml) { var entity = Activator.CreateInstance(); var properties = typeof(T).GetProperties(BindingFlags.Instance | BindingFlags.Public); foreach (PropertyInfo pi in properties) { try { var objValue = GetObjectValue(pi, xml); pi.SetValue(entity, Convert.ChangeType(objValue, pi.PropertyType), null); } finally { } } return entity; } private