Method GetEnumItemsAsListItems
GetEnumItemsAsListItems(Type?, Func<object?, string?>?, Func<object?, bool>?)
Converts the values of a specified enumeration type into a collection of ListControlItem objects.
public static BaseCollection<ListControlItem>? GetEnumItemsAsListItems(Type? enumType, Func<object?, string?>? valueToString = null, Func<object?, bool>? isValueIncluded = null)
Parameters
enumTypeTypeThe type of the enumeration to convert. Must be a valid enumeration type. If
null, the method returnsnull.valueToStringFunc<object, string>A function that converts an enumeration value to its string representation. Cannot be
null.isValueIncludedFunc<object, bool>A function that determines whether an enumeration value is included in the result collection.
Returns
- BaseCollection<ListControlItem>
A BaseCollection<T> containing ListControlItem objects, where each item represents a value from the specified enumeration. Returns
nullifenumTypeisnull.
Remarks
Each ListControlItem in the returned collection
has its Value property set to the enumeration
value and its Text property set to the
string representation provided by valueToString.