+ // Decode a buffer of bytes into a string.
+ [ComVisible (false)]
+ public unsafe override String GetString (byte [] bytes, int index, int count)
+ {
+ if (bytes == null)
+ throw new ArgumentNullException ("bytes");
+ if (index < 0 || index > bytes.Length)
+ throw new ArgumentOutOfRangeException ("index", _("ArgRange_Array"));
+ if (count < 0 || count > (bytes.Length - index))
+ throw new ArgumentOutOfRangeException ("count", _("ArgRange_Array"));
+
+ if (count == 0)
+ return string.Empty;
+
+ // GetCharCountInternal
+ int charCount = count / 2;
+ string s = string.InternalAllocateStr (charCount);
+
+ fixed (byte* bytePtr = bytes)
+ fixed (char* charPtr = s)
+ GetCharsInternal (bytePtr + index, count, charPtr, charCount);
+
+ return s;
+ }
+