explicit conversion in C#

 

For Example : Write a program to demonstrate the use of explicit conversion.

  class Program

    {

        static void Main(string[] args)

        {

            double x = 4562.8568;

            int y;

            y = (int)x;  // here convert  double to int  

            Console.WriteLine(" Value of x is after converted: " + y);

            Console.Read();

        }

    } 

Output:

Comments

Popular posts from this blog

simple program C#

Regular Expression Validator Control in asp.net

two dimension array in C#