System.Security.Cryptography.X509Certificates.X509Certificate2Collection does not contain definition for 'Cast'

StackOverflow https://stackoverflow.com/questions/20616626

Domanda

I'm trying to create a MapReduce job using HDInsight .NET SDK tutorial.

In creating the JobSubmissionCertificateCredential object, specifically the following line:

X509Certificate2 cert = store.Certificates.Cast<X509Certificate2>().First(item => item.FriendlyName == certfriendlyname);

I'm getting the following error: 'System.Security.Cryptography.X509Certificates.X509Certificate2Collection' does not contain a definition for 'Cast' and no extension method 'Cast' accepting a first argument of type 'System.Security.Cryptography.X509Certificates.X509Certificate2Collection' could be found (are you missing a using directive or an assembly reference?)

I have...

  • using System.Security.Cryptography.X509Certificates; at the top of my class.
  • ran Install-Package Microsoft.WindowsAzure.Management.HDInsight

Anyone know of any updates to this block of code that gets the Cast working? Thanks!

È stato utile?

Soluzione

Cast<T> is part of the Enumerable type located in the System.Linq namespace. Add a reference to that namespace and you'll be good.

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top