uint C# with Example



uint C# with Example

An unsigned integer, or uint, is a numeric datatype that only can hold positive integers. Like it's name suggests, it 
represents an unsigned 32-bit integer. The uint keyword itself is an alias for the Common Type System type 
System.UInt32. This datatype is present in mscorlib.dll, which is implicitly referenced by every C# project when 
you create them. It occupies four bytes of memory space. 
Unsigned integers can hold any value from 0 to 4,294,967,295. 
Examples on how and now not to declare unsigned integers 
uint i = 425697; // Valid expression, explicitly stated to compiler 
var i1 = 789247U; // Valid expression, suffix allows compiler to determine datatype 
uint x = 3.0; // Error, there is no implicit conversion 
Please note: According to Microsoft, it is recommended to use the int datatype wherever possible as the uint 
datatype is not CLS-compliant. 

0 Comment's

Comment Form