MemoryStorage.Minus(int,decimal) - YiZhang-Paul/Mock_Up_Calculator GitHub Wiki
Namespace: StorageClassLibrary
Description: Subtracts arbitrary value from value at specified index.
Parameters | Description |
---|---|
key<int> | index to subtract from |
value<decimal> | value to subtract |
Returns | Description |
---|---|
void | this method does not return anything |
Exceptions | Cause |
---|---|
ArgumentOutOfRangeException | key < 0 or key >= Size of storage |
OverflowException | subtraction results in a value larger than decimal.MaxValue |
Examples:
decimal[] values = { 1, 3, 5, 7 };
var storage = new MemoryStorage(values); //now contains [1, 3, 5, 7]
storage.Minus(0, 9); //now contains [-8, 3, 5, 7]
storage.Minus(1, -7); //now contains [-8, 10, 5, 7]
storage.Minus(-1, 9); //will throw exception
storage.Minus(2, -1 * decimal.MaxValue); //will throw exception