Int32.GetTypeCode Method in C# with Examples
Int32.GetTypeCode method is used to get the TypeCode for value type Int32.
Syntax: public TypeCode GetTypeCode ();
Return Value: This method returns the enumerated constant Int32.
Below programs illustrate the use of the above discussed-method:
Example 1:
using System;
class GFG {
public static void Main()
{
int s1 = 3256;
TypeCode result = s1.GetTypeCode();
Console.WriteLine( "TypeCode for Int32 is: {0}" ,
result);
}
}
|
Output:
TypeCode for Int32 is: Int32
Example 2:
using System;
class GFG {
public static void Main()
{
result(Int32.MinValue);
result(Int32.MaxValue);
}
public static void result( int val)
{
TypeCode code = val.GetTypeCode();
Console.WriteLine( "TypeCode for {0} is {1}" ,
val, code);
}
}
|
Output:
TypeCode for -2147483648 is Int32
TypeCode for 2147483647 is Int32
Reference:
Last Updated :
04 Apr, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...