Friday, 29 August 2014

how to print data types from variables in Csharp

using System;
class Program
{
    static void Main()
    {
        // how to print data types from variables 

        var i = 10;

        Console.WriteLine(i.GetType());
        var k = 23.1565;
        Console.WriteLine(k.GetType());
        var s = "panduraju";
        Console.WriteLine(s.GetType());
        var m = 3.156f;
        Console.WriteLine(m.GetType());
        var n = 3.14m;
        Console.WriteLine(n.GetType());
        Console.ReadLine();
    }
}


how to print data types from variables in Csharp
Output

No comments:

Post a Comment