Encodes the characters in a specified string object into a sequence of bytes.
A byte array that contains the encoded characters in the string specified by the s parameter.
Type Reason ArgumentException Error-checking is turned on for the current instance and s contains an invalid surrogate sequence. ArgumentNullException s is null.
If error-checking is turned off and an invalid surrogate sequence is detected, the invalid characters are ignored and are not encoded into the returned byte array, and no exception is thrown.