Skip to content

Commit

Permalink
Merge pull request dotnet#6003 from Clockwork-Muse/master
Browse files Browse the repository at this point in the history
Add missing parameter names to BitArray.CopyTo exceptions
  • Loading branch information
tarekgh authored Jun 26, 2016
2 parents 8e95887 + db472c4 commit 5257068
Showing 1 changed file with 17 additions and 17 deletions.
34 changes: 17 additions & 17 deletions src/mscorlib/src/System/Collections/BitArray.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public BitArray(int length)
=========================================================================*/
public BitArray(int length, bool defaultValue) {
if (length < 0) {
throw new ArgumentOutOfRangeException("length", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
throw new ArgumentOutOfRangeException(nameof(length), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
}
Contract.EndContractBlock();

Expand All @@ -67,14 +67,14 @@ public BitArray(int length, bool defaultValue) {
=========================================================================*/
public BitArray(byte[] bytes) {
if (bytes == null) {
throw new ArgumentNullException("bytes");
throw new ArgumentNullException(nameof(bytes));
}
Contract.EndContractBlock();
// this value is chosen to prevent overflow when computing m_length.
// m_length is of type int32 and is exposed as a property, so
// type of m_length can't be changed to accommodate.
if (bytes.Length > Int32.MaxValue / BitsPerByte) {
throw new ArgumentException(Environment.GetResourceString("Argument_ArrayTooLarge", BitsPerByte), "bytes");
throw new ArgumentException(Environment.GetResourceString("Argument_ArrayTooLarge", BitsPerByte), nameof(bytes));
}

m_array = new int[GetArrayLength(bytes.Length, BytesPerInt32)];
Expand Down Expand Up @@ -112,7 +112,7 @@ public BitArray(byte[] bytes) {

public BitArray(bool[] values) {
if (values == null) {
throw new ArgumentNullException("values");
throw new ArgumentNullException(nameof(values));
}
Contract.EndContractBlock();

Expand All @@ -138,12 +138,12 @@ public BitArray(bool[] values) {
=========================================================================*/
public BitArray(int[] values) {
if (values == null) {
throw new ArgumentNullException("values");
throw new ArgumentNullException(nameof(values));
}
Contract.EndContractBlock();
// this value is chosen to prevent overflow when computing m_length
if (values.Length > Int32.MaxValue / BitsPerInt32) {
throw new ArgumentException(Environment.GetResourceString("Argument_ArrayTooLarge", BitsPerInt32), "values");
throw new ArgumentException(Environment.GetResourceString("Argument_ArrayTooLarge", BitsPerInt32), nameof(values));
}

m_array = new int[values.Length];
Expand All @@ -161,7 +161,7 @@ public BitArray(int[] values) {
=========================================================================*/
public BitArray(BitArray bits) {
if (bits == null) {
throw new ArgumentNullException("bits");
throw new ArgumentNullException(nameof(bits));
}
Contract.EndContractBlock();

Expand Down Expand Up @@ -191,7 +191,7 @@ public bool this[int index] {
=========================================================================*/
public bool Get(int index) {
if (index < 0 || index >= Length) {
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
}
Contract.EndContractBlock();

Expand All @@ -206,7 +206,7 @@ public bool Get(int index) {
=========================================================================*/
public void Set(int index, bool value) {
if (index < 0 || index >= Length) {
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_Index"));
throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_Index"));
}
Contract.EndContractBlock();

Expand Down Expand Up @@ -240,7 +240,7 @@ public void SetAll(bool value) {
=========================================================================*/
public BitArray And(BitArray value) {
if (value==null)
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
if (Length != value.Length)
throw new ArgumentException(Environment.GetResourceString("Arg_ArrayLengthsDiffer"));
Contract.EndContractBlock();
Expand All @@ -262,7 +262,7 @@ public BitArray And(BitArray value) {
=========================================================================*/
public BitArray Or(BitArray value) {
if (value==null)
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
if (Length != value.Length)
throw new ArgumentException(Environment.GetResourceString("Arg_ArrayLengthsDiffer"));
Contract.EndContractBlock();
Expand All @@ -284,7 +284,7 @@ public BitArray Or(BitArray value) {
=========================================================================*/
public BitArray Xor(BitArray value) {
if (value==null)
throw new ArgumentNullException("value");
throw new ArgumentNullException(nameof(value));
if (Length != value.Length)
throw new ArgumentException(Environment.GetResourceString("Arg_ArrayLengthsDiffer"));
Contract.EndContractBlock();
Expand Down Expand Up @@ -320,7 +320,7 @@ public int Length {
}
set {
if (value < 0) {
throw new ArgumentOutOfRangeException("value", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
throw new ArgumentOutOfRangeException(nameof(value), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
}
Contract.EndContractBlock();

Expand Down Expand Up @@ -353,13 +353,13 @@ public int Length {
public void CopyTo(Array array, int index)
{
if (array == null)
throw new ArgumentNullException("array");
throw new ArgumentNullException(nameof(array));

if (index < 0)
throw new ArgumentOutOfRangeException("index", Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));
throw new ArgumentOutOfRangeException(nameof(index), Environment.GetResourceString("ArgumentOutOfRange_NeedNonNegNum"));

if (array.Rank != 1)
throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"));
throw new ArgumentException(Environment.GetResourceString("Arg_RankMultiDimNotSupported"), nameof(array));

Contract.EndContractBlock();

Expand Down Expand Up @@ -387,7 +387,7 @@ public void CopyTo(Array array, int index)
b[index + i] = ((m_array[i/32] >> (i%32)) & 0x00000001) != 0;
}
else
throw new ArgumentException(Environment.GetResourceString("Arg_BitArrayTypeUnsupported"));
throw new ArgumentException(Environment.GetResourceString("Arg_BitArrayTypeUnsupported"), nameof(array));
}

public int Count
Expand Down

0 comments on commit 5257068

Please sign in to comment.