Open In App

C# | Convert.GetTypeCode(Object) Method

Last Updated : 02 Sep, 2021
Comments
Improve
Suggest changes
Like Article
Like
Report

This method is used to return the TypeCode for the specified object.
Syntax:

public static TypeCode GetTypeCode (object value);


Here, the value is an object that implements the IConvertible interface.
Return Value: This method returns the TypeCode for value, or Empty if value is null.
Below programs illustrate the use of Convert.GetTypeCode(Object) Method:
Example 1: 


Output: 
TypeCode of val1 is String
TypeCode of val2 is Boolean

 

Example 2:


Output: 
TypeCode of a is Char
TypeCode of 20 is Single

 

Reference: 


Next Article

Similar Reads