System.Xml.Linq.Extensions.GetProperty C# (CSharp) Méthode

GetProperty() public static méthode

public static GetProperty ( this xElement ) : object
xElement this
Résultat object
        public static object GetProperty(this XElement xElement)
        {
            object prop = null;

            string propType = xElement.Name.LocalName;
            switch (propType)
            {
                case "string":
                    prop = xElement.Value;
                    break;
                case "int":
                    prop = Convert.ToInt32(xElement.Value);
                    break;
                case "bool":
                    prop = Convert.ToBoolean(xElement.Value);
                    break;

                default:
                    throw new NotImplementedException();
            }


            return prop;
        }