What is the difference between Int32 and UInt32?

Fitzchak Yitzchaki picture Fitzchak Yitzchaki · Feb 21, 2010 · Viewed 65.8k times · Source

What is the difference between Int32 and UInt32?

If they are the same with capacity range capabilities, the question is for what reason UInt32 was created? When should I use UInt32 instead of Int32?

Answer

Otávio Décio picture Otávio Décio · Feb 21, 2010

UInt32 does not allow for negative numbers. From MSDN:

The UInt32 value type represents unsigned integers with values ranging from 0 to 2 to the power of 32 or 2**32 (which equals to 4,294,967,295).