- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Type.GetTypeCode() Method in C#
The Type.GetTypeCode() method in C# is used to get the underlying type code of the specified Type.
Syntax
Following is the syntax −
public static TypeCode GetTypeCode (Type type);
Above, the type parameter is the type whose underlying type code to get.
Example
Let us now see an example to implement the Type.GetTypeCode() method −
using System; public class Demo { public static void Main(){ Type type1 = typeof(double); TypeCode type2 = Type.GetTypeCode(type1); Console.WriteLine("TypeCode = "+type2); } }
Output
This will produce the following output −
TypeCode = Double
Example
Let us now see another example to implement the Type.GetTypeCode() method −
using System; public class Demo { public static void Main(){ Type type1 = typeof(short); TypeCode type2 = Type.GetTypeCode(type1); Console.WriteLine("TypeCode = "+type2); } }
Output
This will produce the following output −
TypeCode = Int16
Advertisements