5YrsLaterDBA
5YrsLaterDBA

Reputation: 34760

uint is 32 bits no matter the system is 32 or 64 bits?

in C#, uint is a UInt32 type so it will be always 32 bits long no matter the OS is 32 or 64 bits. Am I right?

Upvotes: 5

Views: 1966

Answers (2)

abatishchev
abatishchev

Reputation: 100258

Yes, you're. UInt32 always represents a 32-bit unsigned integer.

Upvotes: 4

Jon Skeet
Jon Skeet

Reputation: 1500465

Yes, that's right. uint is always an alias for global::System.UInt32 (and yes, that's always 32 bits :). The same logic applies for the other predefined aliases.

The only built-in value type I can think of which has a size varying by platform is IntPtr, for obvious reasons. (Any value type which composes an IntPtr would have the same behaviour, of course. SafeHandle springs to mind.)

Upvotes: 12

Related Questions