enums as numbers c#
public enum Season
{
Spring,
Summer,
Autumn,
Winter
}
public class EnumConversionExample
{
public static void Main()
{
Season a = Season.Autumn;
Console.WriteLine($"Integral value of {a} is {(int)a}"); // output: Integral value of Autumn is 2
var b = (Season)1;
Console.WriteLine(b); // output: Summer
var c = (Season)4;
Console.WriteLine(c); // output: 4
}
}
Also in C#:
- Unity3d GPS code
- json stringify c#
- c# iorderedenumerable to dictionary
- how to convert iformfile to byte array c#
- c sharp check if key in dictionary
- unity method on scene loaded
- c# tostring mmm dd yyyy
- autoresetevent
- unity how to get y value
- Unity C# make object face away
- c# convert excel column index to letter
- split on uppercase c#
- datatable return column names
- unity detect number key
- f string C#
- unity position ui element
- page refresh on button click in c#
- There is already an open DataReader associated with this Command which must be closed first c#
- convert string to datetime c#
- hasmap c#
- solid principles c#
- unity get scrollbar value
- countdownevent
- unity add component