Table of Contents

Method GetEnumItemsAsListItems

Namespace
Alternet.UI
Assembly
Alternet.UI.Common.dll

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

enumType Type

The type of the enumeration to convert. Must be a valid enumeration type. If null, the method returns null.

valueToString Func<object, string>

A function that converts an enumeration value to its string representation. Cannot be null.

isValueIncluded Func<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 null if enumType is null.

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.