mirror of
https://github.com/CommunityToolkit/dotnet.git
synced 2026-10-19 21:56:59 +08:00
Minor codegen improvement
This commit is contained in:
+10
-1
@@ -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");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user