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); }