Метод SByte.GetTypeCode в C # с примерами

Опубликовано: 6 Марта, 2022

Метод SByte.GetTypeCode используется для получения TypeCode для типа значения SByte .

Syntax: public TypeCode GetTypeCode ();

Return Value: This method returns the enumerated constant SByte.

Ниже приведены программы, иллюстрирующие использование вышеупомянутого метода:

Пример 1:

Example 2:

// 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

Ссылка:

  • https://docs.microsoft.com/en-us/dotnet/api/system.sbyte.gettypecode?view=netcore-2.1
C#