Decimal.Add(Decimal, Decimal) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 Decimal 두 값을 추가합니다.
public:
static System::Decimal Add(System::Decimal d1, System::Decimal d2);
public static decimal Add(decimal d1, decimal d2);
static member Add : decimal * decimal -> decimal
Public Shared Function Add (d1 As Decimal, d2 As Decimal) As Decimal
매개 변수
- d1
- Decimal
추가할 첫 번째 값입니다.
- d2
- Decimal
추가할 두 번째 값입니다.
반품
d1와 d2의 합입니다.
예외
10 d1 진수보다 작거나 d2Decimal.MaxValue보다 큰 합계입니다.
설명
다음 코드 샘플에서는 다음을 Add 사용하는 방법을 보여 줍니다.
class PiggyBank {
public void AddPenny() {
MyFortune = Decimal.Add(MyFortune, .01m);
}
public override string ToString() {
return MyFortune.ToString("C")+" in piggy bank";
}
protected decimal MyFortune;
}
type PiggyBank() =
let mutable myFortune = 0m
member _.AddPenny() =
myFortune <- Decimal.Add(myFortune, 0.01m)
override _.ToString() =
$"{myFortune:C} in piggy bank"
Class PiggyBank
Public Sub AddPenny()
MyFortune = [Decimal].Add(MyFortune, 0.01D)
End Sub
Public Overrides Function ToString() As String
Return MyFortune.ToString("C") + " in piggy bank"
End Function
Protected MyFortune As Decimal
End Class