Possible Duplicate:
Why is Array.Length an int, and not an uint
Is there is a reason behind it .NET Framework not using unsigned data types?
Shouldn't I be adopting them in my code, but for example, the Count property of a List<> is an int. You can't have a negative count, so why shouldn't it be defined as a uint? Should I use only int's even though I know the count can not be negative?
NET aware languages do allow unsigned ints. E.g. in C# you can use uint. However, as they not CLS compliant if you expose them outside of your assembly then you might find that other developers using a different language will have problems using your classes.
In any case, the reason unsigned integers are not CLS compliant is that Microsoft decided that languages didn't have to support unsigned integers in order to be considered "CLS compatible".
Ulong is an unsigned long integer datatype in computer programming languages and operating systems. Ulong tea, an alternate spelling for oolong tea.
uint is a keyword that is used to declare a variable which can store an integral type of value (unsigned integer) from the range of 0 to 4,294,967,295.
Unsigned numeric types are not CLS compliant so they should not be used for any API - especially the .NET framework.
Basically, CLS compliant code only utilizes types that are available in all .NET languages. Some languages (like VB.NET) does not support unsigned numeric types.
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