public ConfigPropertyObject(string name, object value, Type type, string displayName = null, string descripton = null) : this(name, value, type.FullName, type.GetTraceLabQualifiedName(), type.IsEnum, displayName, descripton, true) { if (IsEnum) { m_value = string.Empty; var enumInfo = new EnumValueCollection(type); EnumInfo = enumInfo; TypeDescriptor.AddProvider(new EnumValueDescriptionProvider(EnumInfo), EnumInfo); Value = value.ToString(); } }
internal EnumValueCollection(Type enumType) { if (enumType.IsEnum) { m_possibleValues = new List<EnumValue>(); foreach (string val in enumType.GetEnumNames()) { EnumValue newVal = new EnumValue(); newVal.Value = val; m_possibleValues.Add(newVal); } m_currentValue = m_possibleValues[0]; m_sourceEnum = enumType.GetTraceLabQualifiedName(); } }