System.ParameterizedStrings.StringFromAsciiBytes C# (CSharp) Method

StringFromAsciiBytes() static private method

static private StringFromAsciiBytes ( byte buffer, int offset, int length ) : string
buffer byte
offset int
length int
return string
		static string StringFromAsciiBytes(byte[] buffer, int offset, int length)
		{
			// Special-case for empty strings
			if (length == 0)
				return string.Empty;

			// new string(sbyte*, ...) doesn't exist in the targeted reference assembly,
			// so we first copy to an array of chars, and then create a string from that.
			char[] chars = new char[length];
			for (int i = 0, j = offset; i < length; i++, j++)
				chars[i] = (char)buffer[j];
			return new string(chars);
		}