Lines Matching refs:Encoding
167 /// Creates a new <see cref="ByteString" /> by encoding the specified text with
168 /// the given encoding.
170 public static ByteString CopyFrom(string text, Encoding encoding)
172 return new ByteString(encoding.GetBytes(text));
176 /// Creates a new <see cref="ByteString" /> by encoding the specified text in UTF-8.
180 return CopyFrom(text, Encoding.UTF8);
192 /// Converts this <see cref="ByteString"/> into a string by applying the given encoding.
195 /// This method should only be used to convert binary data which was the result of encoding
196 /// text with the given encoding.
198 /// <param name="encoding">The encoding to use to decode the binary data into text.</param>
200 public string ToString(Encoding encoding)
202 return encoding.GetString(bytes, 0, bytes.Length);
206 /// Converts this <see cref="ByteString"/> into a string by applying the UTF-8 encoding.
209 /// This method should only be used to convert binary data which was the result of encoding
215 return ToString(Encoding.UTF8);