Implicit Conversion from 8-bit Signed Integer (sbyte) to Decimal in C#



SByte represents an 8-bit signed integer.

To implicitly convert an 8-bit signed integer to a Decimal, firstly set an sbyte value.

sbyte val = 51;

To convert sbyte to decimal, assign the value.

decimal d;
d = val;

Let us see another example.

Example

using System;
public class Demo {
   public static void Main() {
      sbyte val = 39;
      decimal d;
      Console.WriteLine("Implicit conversion from 8-bit signed integer (sbyte) to Decimal");
      d = val;
      Console.WriteLine("Decimal = "+dec);
   }
}
Updated on: 2020-06-23T07:50:23+05:30

231 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements