|
Listing 10-20 extracted from chapter The .NET 2 type system from a C#2 point of view
Listing 10-19< > Listing 10-21
This listing can be compiled with the command line: csc.exe /target:exe Example_10_20.cs Errors: 0 Warnings: 0
Example_10_20.cs
class Program {
static void Main() {
int i = -5;
checked {
byte b = (byte)i; // Exception raised. The 'byte' type can't
} // represent any negative integer.
}
}
Copyright Patrick Smacchia 2006 2007
|