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






explicit cast

 

using System;

class ExplicitConv {
    static void Main() {
        double a = 5.654321;
        int b;

        b = (int)a;
        Console.WriteLine("The value is {0}", b);
    }
}

 








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.Implicit cast