SByte.GetTypeCode Method in C# with Examples
Last Updated :
11 Jul, 2025
Improve
SByte.GetTypeCode method is used to get the TypeCode for value type SByte.
csharp
csharp
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:
// 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:
Example 2:
TypeCode for SByte is: SByte
// 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:
Reference:
TypeCode for -128 is SByte TypeCode for 127 is SByte