In the .NET System.TypeCode enum, the values are as follows:
public enum TypeCode {
...
Double=14,
Decimal=15,
DateTime=16,
String=18,
}
String equals 18.. Why not 17? Where is the logic?
You can assign any number (integer in your case) in any order to enum elements. If value is not assigned explicitely, then by default first value will be 0. All other values which not assigned exmplicitely will increment previous element's value by one:
public enum TypeCode
{
Double = 42,
Decimal, // 43
DateTime = 0,
String = 18
}
UPDATE
Why System.TypeCode has value 17 missing - because there used to be TimeSpan type, but it was removed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With