本文整理汇总了C#中System.Security.Cryptography.X509Certificates.X509CertificateCollection.IndexOf方法的典型用法代码示例。如果您正苦于以下问题:C# X509CertificateCollection.IndexOf方法的具体用法?C# X509CertificateCollection.IndexOf怎么用?C# X509CertificateCollection.IndexOf使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Security.Cryptography.X509Certificates.X509CertificateCollection
的用法示例。
在下文中一共展示了X509CertificateCollection.IndexOf方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Insert
public void Insert ()
{
X509CertificateCollection c = new X509CertificateCollection ();
c.Add (x509a);
Assert.AreEqual (0, c.IndexOf (x509a), "a=0");
c.Add (x509c);
Assert.AreEqual (1, c.IndexOf (x509c), "c=1");
c.Insert (1, x509b);
Assert.AreEqual (1, c.IndexOf (x509b), "1");
Assert.AreEqual (2, c.IndexOf (x509c), "2");
}
示例2: Insert
public void Insert ()
{
X509CertificateCollection c = new X509CertificateCollection ();
c.Add (x509a);
AssertEquals ("a=0", 0, c.IndexOf (x509a));
c.Add (x509c);
AssertEquals ("c=1", 1, c.IndexOf (x509c));
c.Insert (1, x509b);
AssertEquals ("1", 1, c.IndexOf (x509b));
AssertEquals ("2", 2, c.IndexOf (x509c));
}
示例3: IndexOf
public void IndexOf ()
{
X509CertificateCollection c = new X509CertificateCollection ();
Assert.AreEqual (-1, c.IndexOf (x509a), "Empty-A");
Assert.AreEqual (-1, c.IndexOf (null), "Empty-Null");
c.Add (x509a);
Assert.AreEqual (0, c.IndexOf (x509a), "A-A");
Assert.AreEqual (-1, c.IndexOf (x509b), "A-B");
// works by object reference (not value)
X509Certificate x = new X509Certificate (cert_a);
Assert.IsTrue (!Object.ReferenceEquals (x509a, x), "!ReferenceEquals");
Assert.AreEqual (0, c.IndexOf (x), "A-x");
}
示例4: IndexOf
public void IndexOf ()
{
X509CertificateCollection c = new X509CertificateCollection ();
AssertEquals ("Empty-A", -1, c.IndexOf (x509a));
AssertEquals ("Empty-Null", -1, c.IndexOf (null));
c.Add (x509a);
AssertEquals ("A-A", 0, c.IndexOf (x509a));
AssertEquals ("A-B", -1, c.IndexOf (x509b));
// works by object reference (not value)
X509Certificate x = new X509Certificate (cert_a);
Assert ("!ReferenceEquals", !Object.ReferenceEquals (x509a, x));
#if NET_2_0
AssertEquals ("A-x", 0, c.IndexOf (x));
#else
AssertEquals ("A-x", -1, c.IndexOf (x));
#endif
}