Sunday, 15 February 2015

variables - C# initializing an integer data type -


How to start a variable of data type integer, in C # The problem is that the variable has to store an integer with values ​​from 1 to 4.

You can use an enum, which by default is typed as Int32 (int) The public enum MyEnum {first value, second value, third value, fourth value}

Obviously you can call enum anytime you want , And give meaning to the four values ​​namely name. After that you can just start an example: -

  var myValue = MyEnum.FirstValue;  

No comments:

Post a Comment