Remove a few initialization allocations from Cng (dotnet/corefx#41373)
authorStephen Toub <stoub@microsoft.com>
Fri, 27 Sep 2019 03:22:52 +0000 (20:22 -0700)
committerGitHub <noreply@github.com>
Fri, 27 Sep 2019 03:22:52 +0000 (20:22 -0700)
commitf322904d502c339cedbcade994e2351fedf1b0ad
tree28862ace5478441db9605c29043414beabd5861c
parent014e734e2da799cb527e501eedeee7cebc1ca997
Remove a few initialization allocations from Cng (dotnet/corefx#41373)

Save four "startup" allocations in System.Security.Cryptography.Cng.

- Appending the '\0' is better done at the call site, because then the concat is done with two constants at compile time.
- There's no benefit to using ToCharArray instead of just passing in the string.
- Once we get rid of those, we can just inline the construction into the declarations.

Commit migrated from https://github.com/dotnet/corefx/commit/296c0e71ddcc4885d30af18dea829c1923cfdc5c
src/libraries/System.Security.Cryptography.Cng/src/Internal/Cryptography/BasicSymmetricCipherNCrypt.cs