/// <summary> /// Reads the Unicode string from the memory block. /// </summary> /// <param name="length"> /// The length of the string to read, in characters. /// </param> /// <returns> /// The string read from the memory block. /// </returns> public string ReadString(int length) { if (0 >= length || _memoryBlock.IsInvalid) { return(null); } if (length > _memoryBlock.Size) { length = _memoryBlock.Size; } return(Marshal.PtrToStringUni(_memoryBlock.DangerousGetHandle(), length)); }