public override PropertyDescriptorCollection GetProperties(ITypeDescriptorContext context, Object value, Attribute[] attributes) { // ReSharper disable PossibleNullReferenceException Enumerations.CheckedListBoxSetting setting = context.PropertyDescriptor.Attributes.OfType<ArgumentsAttribute>().First().CheckedListBoxSetting; // ReSharper restore PossibleNullReferenceException List<PropertyDescriptor> properties = new(); switch (setting) { case Enumerations.CheckedListBoxSetting.ServerVariables: properties.AddRange(Settings.Values.Variables.Select(variable => new PropertyBagDescriptor(variable, typeof(String), null))); break; } return new PropertyDescriptorCollection(properties.ToArray()); }
public ArgumentsAttribute(Enumerations.CheckedListBoxSetting checkedListBoxSetting) { CheckedListBoxSetting = checkedListBoxSetting; }