Implicit conversion from 8-bit signed integer (SByte) to Decimal in C#

CsharpProgrammingServer Side Programming

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.


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 23-Jun-2020 07:50:23