If (O Is Fraction) ( (Fraction) O) .Show Fraction F o As Fraction If (F ! Null) F.Show
If (O Is Fraction) ( (Fraction) O) .Show Fraction F o As Fraction If (F ! Null) F.Show
Console.WriteLine(c.GetType()); // System.Int32
bool result = o is int; // operator "is"
Console.WriteLine(result); // True
o = "abcdef";
// string str = o; // Error
string str = o as string; // operator "as"
if ( str == null )
Console.WriteLine("o is not a string");
else
Console.WriteLine("o is a string {0}", str);
Priority Table
Category Operators Associativity
Primary x.y f(x) a[x] x++ x-- new
typeof checked unchecked
Unary + - ! ~ ++x --x (T)x
Multiplicative * / % left to right
Additive + - left to right
Shift << >> left to right
Relational and type testing < > <= >= is as left to right
Equality == != left to right
Logical AND & left to right
Logical XOR ^ left to right
Logical OR | left to right
Conditional AND && left to right
Conditional OR || left to right
Conditional ?: right to left
Assignment = *= /= %= += -= <<= >>= &= ^= |= right to left