Skip to content

Commit

Permalink
Remove object[] allocation from InMemoryCryptoProviderCache.GetCacheK…
Browse files Browse the repository at this point in the history
…eyPrivate (#2181)

There's a params object[] being allocated. On .NET 6+, using an interpolated string will avoid that. On < .NET 6, it'll be exactly what it was before (InvariantCulture isn't needed as nothing here is affected by culture).
  • Loading branch information
stephentoub authored and Brent Schmaltz committed Jul 28, 2023
1 parent 6062d7e commit 53e1f90
Showing 1 changed file with 1 addition and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -102,12 +102,7 @@ protected override string GetCacheKey(SecurityKey securityKey, string algorithm,

private static string GetCacheKeyPrivate(SecurityKey securityKey, string algorithm, string typeofProvider)
{
return string.Format(CultureInfo.InvariantCulture,
"{0}-{1}-{2}-{3}",
securityKey.GetType(),
securityKey.InternalId,
algorithm,
typeofProvider);
return $"{securityKey.GetType()}-{securityKey.InternalId}-{algorithm}-{typeofProvider}";
}

/// <summary>
Expand Down

0 comments on commit 53e1f90

Please sign in to comment.