Set value to [Flags] Enum from list c# -
I need to set the value of the values taken from the list.
I have Enum:
[flags] public enum EnumTest {Val1 = 1, Val2 = 2, Val3 = 4}
var value = new list & lt; EnumTest & gt; {EnumTest.Val1, EnumTest.Val3};
How can I get the following results using an advance?
var result = EnumTest.Val1 | EnumTest.Val3;
Thanks
Here's a solution using the link:
var result = value. Apply ((x, y) => x | = y);
Comments
Post a Comment