using System.Security.Cryptography; Rijndael rijndael = Rijndael.Create(); rijndael.GenerateKey(); byte[] key = rijndael.Key;
using System.Security.Cryptography; RijndaelManaged rijndael = new RijndaelManaged(); rijndael.GenerateKey(); byte[] key = rijndael.Key;In this example, a new instance of the RijndaelManaged encryption algorithm is created using the new keyword. The GenerateKey() method is then called on this instance to generate a random key, which is then assigned to the key variable. Both of these examples use the System.Security.Cryptography package in C# to access the Rijndael encryption algorithm.