Open In App

SByte.GetTypeCode Method in C# with Examples

Last Updated : 01 May, 2019
Comments
Improve
Suggest changes
Like Article
Like
Report
SByte.GetTypeCode method is used to get the TypeCode for value type SByte.
Syntax: public TypeCode GetTypeCode (); Return Value: This method returns the enumerated constant SByte.
Below programs illustrate the use of the above discussed-method: Example 1: csharp
// C# program to illustrate the
// SByte.GetTypeCode() Method
using System;

class GFG {

    // Main Method
    public static void Main()
    {

        // Taking sbyte value
        sbyte s1 = 56;

        // Getting the typecode for SByte
        // using GetTypeCode() method
        TypeCode result = s1.GetTypeCode();

        // Display the TypeCode
        Console.WriteLine("TypeCode for SByte is: {0}",
                                               result);
    }
}
Output:
TypeCode for SByte is: SByte
Example 2: csharp
// C# program to illustrate the
// SByte.GetTypeCode() Method
using System;

class GFG {

    // Main Method
    public static void Main()
    {
        // using result() Method
        result(SByte.MinValue);
        result(SByte.MaxValue);
    }

    // result() method
    public static void result(sbyte val)
    {

        // using GetTypeCode() method
        TypeCode code = val.GetTypeCode();

        // Display the TypeCode
        Console.WriteLine("TypeCode for {0} is {1}",
                                         val, code);
    }
}
Output:
TypeCode for -128 is SByte
TypeCode for 127 is SByte
Reference:

Next Article

Similar Reads