Complete the code to declare an enum named Color.
[1] Color { Red, Green, Blue }The keyword enum is used to declare an enumeration type in C#.
Complete the code to get the underlying numeric value of the enum member.
int value = (int)Color.[1];To get the numeric value of an enum member, cast it to int and use the member name.
Fix the error in the code to correctly cast the enum to its underlying value.
var number = [1]Color.Green;To get the numeric value of an enum member, cast it to int.
Fill both blanks to create a dictionary mapping enum members to their numeric values.
var dict = new Dictionary<Color, int> { [1], [2] };The dictionary keys are enum members and values are their underlying int values.
Fill all three blanks to create a LINQ expression mapping enum members to their numeric values if the value is greater than 0.
var result = Enum.GetValues(typeof(Color)).Cast<Color>().Where([3] => (int)[3] > 0).ToDictionary([1] => [1], [1] => [2]);
This uses LINQ's ToDictionary method along with Where to map each qualifying enum member to its int value.