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.

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);
   }
}
raja
Published on 12-Sep-2018 12:55:26
Advertisements