Implicit conversion from Int32 to Decimal in C#

CsharpProgrammingServer Side Programming

The int type represents a 32-bit signed integer i.e. Int32.

To implicitly convert an Int32 to a Decimal, firstly set a Int32 value.

int val = 392;

To convert Int32 to decimal, assign the value.

decimal d;
d = val;

Let us see another example.


using System;
public class Demo {
   public static void Main() {
      int val = 767;
      decimal d;
      Console.WriteLine("Implicit conversion from Int32 (integer) to Decimal");
      d = val;
      Console.WriteLine("Decimal : "+dec);
Updated on 23-Jun-2020 07:54:11