
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Get TypeCode for Value Type Decimal in C#
To get the TypeCode for value type Decimal, the code is as follows −
Example
using System; public class Demo { public static void Main(){ Decimal val = Decimal.MaxValue; Console.WriteLine("Decimal Value = {0}", val); Console.WriteLine("HashCode = {0}", (val.GetHashCode()) ); TypeCode type = val.GetTypeCode(); Console.WriteLine("TypeCode = "+type); } }
Output
This will produce the following output −
Decimal Value = 79228162514264337593543950335 HashCode = 1173356544 TypeCode = Decimal
Example
Let us now see another example −
using System; public class Demo { public static void Main(){ Decimal val = 3972.491M; Console.WriteLine("Decimal Value = {0}", val); Console.WriteLine("HashCode = {0}", (val.GetHashCode()) ); TypeCode type = val.GetTypeCode(); Console.WriteLine("TypeCode = "+type); } }
Output
This will produce the following output −
Decimal Value = 3972.491 HashCode = 620041307 TypeCode = Decimal
Advertisements