diff options
Diffstat (limited to 'src/mscorlib/src/System/Collections/Stack.cs')
-rw-r--r-- | src/mscorlib/src/System/Collections/Stack.cs | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/mscorlib/src/System/Collections/Stack.cs b/src/mscorlib/src/System/Collections/Stack.cs index 0384a4ee81..c3ad15abd8 100644 --- a/src/mscorlib/src/System/Collections/Stack.cs +++ b/src/mscorlib/src/System/Collections/Stack.cs @@ -44,7 +44,7 @@ namespace System.Collections { // must be a non-negative number. public Stack(int initialCapacity) { if (initialCapacity < 0) - throw new ArgumentOutOfRangeException("initialCapacity", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); + throw new ArgumentOutOfRangeException(nameof(initialCapacity), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); Contract.EndContractBlock(); if (initialCapacity < _defaultCapacity) initialCapacity = _defaultCapacity; // Simplify doubling logic in Push. @@ -59,7 +59,7 @@ namespace System.Collections { public Stack(ICollection col) : this((col==null ? 32 : col.Count)) { if (col==null) - throw new ArgumentNullException("col"); + throw new ArgumentNullException(nameof(col)); Contract.EndContractBlock(); IEnumerator en = col.GetEnumerator(); while(en.MoveNext()) @@ -121,11 +121,11 @@ namespace System.Collections { // Copies the stack into an array. public virtual void CopyTo(Array array, int index) { if (array==null) - throw new ArgumentNullException("array"); + throw new ArgumentNullException(nameof(array)); if (array.Rank != 1) throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported")); if (index < 0) - throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); + throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum")); if (array.Length - index < _size) throw new ArgumentException(Environment.GetResourceString("Argument_InvalidOffLen")); Contract.EndContractBlock(); @@ -189,10 +189,9 @@ namespace System.Collections { // Returns a synchronized Stack. // - [HostProtection(Synchronization=true)] public static Stack Synchronized(Stack stack) { if (stack==null) - throw new ArgumentNullException("stack"); + throw new ArgumentNullException(nameof(stack)); Contract.Ensures(Contract.Result<Stack>() != null); Contract.EndContractBlock(); return new SyncStack(stack); @@ -363,7 +362,7 @@ namespace System.Collections { public StackDebugView( Stack stack) { if( stack == null) - throw new ArgumentNullException("stack"); + throw new ArgumentNullException(nameof(stack)); Contract.EndContractBlock(); this.stack = stack; |