From 0953d8592b4a0e0f8f6910da10f440502b686eb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jos=C3=A9=20Sim=C3=B5es?= Date: Thu, 2 Aug 2018 12:37:25 +0100 Subject: [PATCH] Add Encoding.GetString() method MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: José Simões --- source/System/Text/Encoding.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/source/System/Text/Encoding.cs b/source/System/Text/Encoding.cs index f0f55ce7..ce747f48 100644 --- a/source/System/Text/Encoding.cs +++ b/source/System/Text/Encoding.cs @@ -123,6 +123,18 @@ public virtual char[] GetChars(byte[] bytes, int byteIndex, int byteCount) throw new NotImplementedException(); } + /// + /// When overridden in a derived class, decodes a sequence of bytes from the specified byte array into a . + /// + /// The byte array containing the sequence of bytes to decode. + /// The index of the first byte to decode. + /// The number of bytes to decode. + /// A that contains the results of decoding the specified sequence of bytes. + public virtual string GetString(byte[] bytes, int index, int count) + { + return new string(GetChars(bytes, index, count)); + } + /// /// When overridden in a derived class, obtains a decoder that converts an encoded sequence of bytes into a sequence of characters. ///