Closed kurnakovv closed 8 months ago
Description
Convert input enums to other enums.
Signature
IEnumerable ToOther<TInputEnum, TOutputEnum>(this IEnumerable, bool [default = true]) where TInputEnum, TOutputEnum : Enum
Type Parameters
TInputEnum - Type of enumValues TOutputEnum - Enum type that we want to get after convert.
TInputEnum
enumValues
TOutputEnum
Parameters
IEnumerable<TInputEnum> enumValues
bool ignoreCase
Returns
IEnumerable<TOutputEnum>
Code examples
// Enums public enum InputEnum { First, Second, Third } public enum OutputEnum { First, Second, Third }
IEnumerable<InputEnum> inputEnums = new List<InputEnum>() { InputEnum.First, InputEnum.Second, InputEnum.Third, }; IEnumerable<OutputEnum> output = inputEnums.ToOther<InputEnum, OutputEnum>(); // or false if case is important. // output // 1 - OutputEnum.First // 2 - OutputEnum.Second // 3 - OutputEnum.Third
ToOther
Description
Convert input enums to other enums.
Signature
IEnumerable ToOther<TInputEnum, TOutputEnum>(this IEnumerable, bool [default = true]) where TInputEnum, TOutputEnum : Enum
Type Parameters
TInputEnum
- Type ofenumValues
TOutputEnum
- Enum type that we want to get after convert.Parameters
IEnumerable<TInputEnum> enumValues
- The input enums that we want to convert to enumerable ofTOutputEnum
.bool ignoreCase
- Ignore or regard case.Returns
IEnumerable<TOutputEnum>
Code examples