Пример #1
0
        internal static PropertyXML Create(ProviderPropertyDefinition pdef, object value)
        {
            PropertyXML propertyXML = new PropertyXML();

            propertyXML.PropertyName = pdef.Name;
            propertyXML.ClassName    = pdef.Type.FullName;
            propertyXML.values       = new List <PropertyValueBaseXML>();
            propertyXML.isDefault    = object.Equals(value, pdef.DefaultValue);
            if (pdef.IsMultivalued && value is MultiValuedPropertyBase)
            {
                MultiValuedPropertyBase multiValuedPropertyBase = (MultiValuedPropertyBase)value;
                using (IEnumerator enumerator = ((IEnumerable)multiValuedPropertyBase).GetEnumerator())
                {
                    while (enumerator.MoveNext())
                    {
                        object value2 = enumerator.Current;
                        PropertyValueBaseXML propertyValueBaseXML = PropertyValueBaseXML.Create(pdef, value2);
                        if (propertyValueBaseXML != null)
                        {
                            propertyXML.values.Add(propertyValueBaseXML);
                        }
                    }
                    return(propertyXML);
                }
            }
            if (value != null)
            {
                PropertyValueBaseXML propertyValueBaseXML2 = PropertyValueBaseXML.Create(pdef, value);
                if (propertyValueBaseXML2 != null)
                {
                    propertyXML.values.Add(propertyValueBaseXML2);
                }
            }
            return(propertyXML);
        }