Decimal.Increment(Decimal) 연산자

정의

Decimal 피연산자를 1씩 증가시킵니다.

public:
 static System::Decimal operator ++(System::Decimal d);
public:
 static System::Decimal operator ++(System::Decimal d) = System::Numerics::IIncrementOperators<System::Decimal>::op_Increment;
public static decimal operator ++ (decimal d);
static member op_Increment : decimal -> decimal
Public Shared op_Increment (d As Decimal) As Decimal

매개 변수

d
Decimal

증가시킬 값입니다.

반환

1씩 증가된 d의 값입니다.

구현

예외

반환 값이 Decimal.MinValue 보다 작거나 Decimal.MaxValue보다 큽니다.

설명

메서드는 Increment 값에 대한 증분 연산자의 연산을 Decimal 정의합니다. 다음과 같은 코드를 사용하도록 설정합니다.

using System;

public class Example
{
   public static void Main()
   {
      Decimal number = 1079.8m;
      Console.WriteLine("Original value:    {0:N}", number);
      Console.WriteLine("Incremented value: {0:N}", ++number);
   }
}
// The example displays the following output:
//       Original value:    1,079.80
//       Incremented value: 1,080.80
open System

let number = 1079.8m
printfn $"Original value:    {number:N}"
printfn $"Incremented value: {Decimal.op_Increment number:N}"

// The example displays the following output:
//       Original value:    1,079.80
//       Incremented value: 1,080.80

증분 연산자가 없는 일부 언어(예: Visual Basic)는 다음 예제와 같이 메서드를 직접 호출 Increment 할 수 있습니다.

Module Example
   Public Sub Main()
      Dim number As Decimal = 1079.8d
      Console.WriteLine("Original value:    {0:N}", number)
      Console.WriteLine("Incremented value: {0:N}", Decimal.op_Increment(number))
   End Sub
End Module
' The example displays the following output:
'       Original value:    1,079.80
'       Incremented value: 1,080.80

언어가 사용자 지정 연산자를 지원하지 않는 경우 다음 예제와 같이 메서드를 대신 호출 Add 합니다.

using System;

public class Example
{
   public static void Main()
   {
      Decimal number = 1079.8m;
      Console.WriteLine("Original value:    {0:N}", number);
      Console.WriteLine("Incremented value: {0:N}", Decimal.Add(number, 1));
   }
}
// The example displays the following output:
//       Original value:    1,079.80
//       Incremented value: 1,080.80
open System

let number = 1079.8m
printfn $"Original value:    {number:N}"
printfn $"Incremented value: {Decimal.Add(number, 1):N}"

// The example displays the following output:
//       Original value:    1,079.80
//       Incremented value: 1,080.80
Module Example
   Public Sub Main()
      Dim number As Decimal = 1079.8d
      Console.WriteLine("Original value:    {0:N}", number)
      Console.WriteLine("Incremented value: {0:N}", Decimal.Add(number, 1))
   End Sub
End Module
' The example displays the following output:
'       Original value:    1,079.80
'       Incremented value: 1,080.80

적용 대상

추가 정보