Minor codegen improvement

This commit is contained in:
Sergio Pedri
2020-04-18 17:22:48 +02:00
parent ba2b57e644
commit 8cc8a9f94d
@@ -243,7 +243,7 @@ namespace Microsoft.Collections.Extensions
if ((uint)newSize > int.MaxValue)
{
throw new InvalidOperationException("Max capacity exceeded");
ThrowInvalidOperationExceptionForMaxCapacityExceeded();
}
var entries = new Entry[newSize];
@@ -328,5 +328,14 @@ namespace Microsoft.Collections.Extensions
{
throw new ArgumentException($"The target key {key} was not present in the dictionary");
}
/// <summary>
/// Throws an <see cref="InvalidOperationException"/> when trying to resize over the maximum capacity.
/// </summary>
[MethodImpl(MethodImplOptions.NoInlining)]
private static void ThrowInvalidOperationExceptionForMaxCapacityExceeded()
{
throw new InvalidOperationException("Max capacity exceeded");
}
}
}