string inputString = "Hello world!"; byte[] utf8Bytes = Encoding.UTF8.GetBytes(inputString);
byte[] utf8Bytes = new byte[] { 72, 101, 108, 108, 111, 32, 119, 111, 114, 108, 100, 33 }; string decodedString = Encoding.UTF8.GetString(utf8Bytes);This code decodes the UTF-8 byte array using the Encoding.UTF8.GetString() method and outputs the string "Hello world!". Package Library: This class is part of the C# core class library and does not require any additional packages or libraries.