Skip to content

StandardCalculator.MemoryPlus(int,decimal)

Yi Zhang edited this page May 29, 2018 · 1 revision

Namespace: CalculatorClassLibrary

Description: Adds arbitrary value to memory value at specified index.

Parameters Description
key<int> index of target memory value
value<decimal> value to add
Returns Description
void this method does not return anything
Exceptions Cause
ArgumentOutOfRangeException key is not a valid index
OverflowException addition results in a value larger than decimal.MaxValue

Examples:

//memory values are [1, 3, 5, 7]
standardCalculator.MemoryPlus(0, 7);                //memory values are now [8, 3, 5, 7]
standardCalculator.MemoryPlus(1, 3);                //memory values are now [8, 6, 5, 7]
standardCalculator.MemoryPlus(-1, 7);               //will throw exception
standardCalculator.MemoryPlus(0, decimal.MaxValue); //will throw exception

Clone this wiki locally