Double.GetTypeCode() Method in C#

Double.GetTypeCode() Method is used to return the TypeCode for value type Double.

Syntax: public TypeCode GetTypeCode ();

Return Value: This method returns the enumerated constant, Double.

Below programs illustrate the use of Double.GetTypeCode() Method:

Example 1:

filter_none

edit
close

play_arrow

link
brightness_4
code

// C# program to demonstrate the
// Double.GetTypeCode()
// Method
using System;
using System.Globalization;
  
class GFG {
  
    // Main Method
    public static void Main()
    {
  
        // Declaring and initializing value1
        double value1 = 10d;
  
        // getting the typeCode
        // using GetTypeCode() method
        TypeCode value = value1.GetTypeCode();
  
        // Display the TypeCode
        Console.WriteLine("TypeCode is {0}", value);
    }
}

chevron_right


Output:

TypeCode is Double

Example 2:

filter_none

edit
close

play_arrow

link
brightness_4
code

// C# program to demonstrate the
// Double.GetTypeCode()
// Method
using System;
using System.Globalization;
  
class GFG {
  
    // Main Method
    public static void Main()
    {
        // calling get() method
        get(5d);
        get(5.5d);
        get(10d);
        get(7.5d);
    }
  
    // defining get() method
    public static void get(double value1)
    {
  
        // getting the TypeCode
        // using GetTypeCode() method
        TypeCode value = value1.GetTypeCode();
  
        // Display the TypeCode
        Console.WriteLine("TypeCode is {0}", value);
    }
}

chevron_right


Output:

TypeCode is Double
TypeCode is Double
TypeCode is Double
TypeCode is Double

Reference:



My Personal Notes arrow_drop_up

Check out this Author's contributed articles.

If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to contribute@geeksforgeeks.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.

Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.




Article Tags :

Be the First to upvote.


Please write to us at contribute@geeksforgeeks.org to report any issue with the above content.