private static OptionConfigurationPropertyCollection GetOptionPropertiesFromType(Type type) { OptionConfigurationPropertyCollection properties; if (_propertyBags.TryGetValue(type, out properties)) { return(properties); } lock (_propertyBags) { if (_propertyBags.TryGetValue(type, out properties)) { return(properties); } properties = new OptionConfigurationPropertyCollection(); foreach (var propertyInfo in type.GetProperties(BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance)) { var property = CreateOptionPropertyFromAttribute(propertyInfo); if (property != null) { properties.Add(property); } } _propertyBags[type] = properties; } return(properties); }
public static OptionConfigurationProperty GetDefaultCollectionProperty(OptionConfigurationPropertyCollection properties) { if (properties == null || properties.Count < 1) { return(null); } return(properties.FirstOrDefault(property => property.IsDefaultCollection)); }