Questions tagged [unchecked-conversion]

The `unchecked` keyword is in .NET used to suppress overflow-checking for integral-type arithmetic operations and conversions.

In an unchecked context, if an expression produces a value that is outside the range of the destination type, the overflow is not flagged.

More info with examples on MSDN.

31 questions
-4
votes
2 answers

Constants and literals explicit conversion

When i try the following : const int x = 1000; byte b1 = (byte)x; //Or byte b2 = (byte)1000; The compiler claims that it didn't convert constant 1000 to b1 or b2. But when i tried the following : const int x = 1000; byte b1 =…
Brahim Boulkriat
  • 984
  • 2
  • 9
  • 21
1 2
3