What is the complementary method of Encoding.UTF8.GetString
That is, if Encoding.UTF8.GetString decodes bytes in a byte array into a string, what method encodes a string into bytes in a byte array, so that
var somestring == Encoding.UTF8.GetString(method(someString));
is true?
The reverse method is Encoding.UTF8.GetBytes. Similar classes exist with the same method for ASCII and UTF16 encodings.
System.Text.Encoding.UTF8.GetBytes("TestString")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With