using System; using System.IO; class Program { static void Main() { byte[] byteArray = new byte[] { 10, 20, 30 }; MemoryStream stream = new MemoryStream(byteArray); Console.WriteLine(stream.Length); Console.WriteLine(stream.ReadByte()); Console.WriteLine(stream.ReadByte()); Console.WriteLine(stream.ReadByte()); } }This code example creates a MemoryStream object that initializes its content with a byte array containing the values 10, 20, and 30. It then prints the length of the stream and each of the bytes in the stream. The package library for MemoryStream is the System.IO package.