X509Certificate2 certificate = new X509Certificate2("mycert.cer"); X509Certificate2Collection collection = new X509Certificate2Collection(); collection.Add(certificate);In this example, a new X509Certificate2 object is created from a certificate file named "mycert.cer". Then, a new X509Certificate2Collection is created and the Add() method is used to add the certificate to the collection. This code example is included in the System.Security.Cryptography.X509Certificates package library, which is part of the .NET Framework.