'How to write below Cryptography code to Bouncy Castle library in C#

Below code is written in .net cryptography. Please suggest example to write using bouncy castle C#

var collection = new X509Certificate2Collection();
            collection.Import(bytes?.FromPkcs7());
            return collection[0].CopyWithPrivateKey(RSA);


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source