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
Implicit conversion from Int16 to Decimal in C#
The short type represents a 16-bit signed integer i.e. Int16.
To implicitly convert a 16-bit signed integer to a Decimal, firstly set a short value.
short val = -32768;
To convert short to decimal, assign the value.
dec = val;
Let us see another example.
Example
using System;
public class Demo {
public static void Main() {
short val = -32768;
decimal dec;
Console.WriteLine("Implicit conversion from Int16 to Decimal");
dec = val;
Console.WriteLine("Decimal : "+dec);
}
}
Output
Implicit conversion from Int16 to Decimal Decimal : -32768
Advertisements