Enum Extensions
This class contains two different methods to deal with enum
types as IEnumerable<T>
collections, where T is equals to the enum
type.
Methods
Name | Parameters | Returns | Description |
AsEnumerable | IEnumerable<T> | Cast a T enum to an IEnumerable which each element is an enum option. | |
AsEnumerableSkipZero | IEnumerable<T> | Cast a T enum to an IEnumerable which each element is an enum option, except by the zero value option. |
Usage
You can transform an enum
type defined by T
to an IEnumerable<T>
. Simplily executes the AsEnumerable
method with enum
type.
See the code bellow:
You can ignore the zero value by using AsEnumerableSkipZero
method, if you need.
Last updated