Implicit cast : cast « Data Types « C# / C Sharp






Implicit cast

 

using System;
class ImplicitConversion {
    public static void Main() {
        byte a = 1;
        int b = 1234;
        int c = a; //Implicit cast
        double d = b; //Implicit cast
        Console.WriteLine("{0}", c);
        Console.WriteLine("{0}", d);
    }
}

 








Related examples in the same category

1.Type convert
2.Conversions between Simple Types
3.Any object, value, or reference type that is convertible to an integral, char, enum, or string type is acceptable as the switch_expression
4.explicit cast