Remove System.Linq dependency from System.Security.Cryptography.X509Certificates
System.Linq was only being used in two places:
- In Pkcs10CertificateRequestInfo, it was using Collection<>.Select(...).ToArray(). We can replace it with a simple for loop, which is both faster (e.g. fewer delegate invocations) and fewer generic instantiations (no one else is going to have an instantiation with AttributeAsn).
- In LoadMachineStores on Linux, it was using Prepend. We can avoid the need for Prepend (and the associated allocations) entirely by slightly reorganizing the method and using a local function.
Commit migrated from https://github.com/dotnet/corefx/commit/
5ad15fcb189a9c232051d03c1e889f985f62232b