/// <summary> /// Reads UTF16 (little-endian) encoded string starting at the current position. /// </summary> /// <param name="byteCount">The number of bytes to read.</param> /// <returns>The string.</returns> /// <exception cref="BadImageFormatException"><paramref name="byteCount"/> bytes not available.</exception> public string ReadUTF16(int byteCount) { string s = _block.PeekUtf16(this.Offset, byteCount); _currentPointer += byteCount; return(s); }
internal string GetString(UserStringHandle handle) { int offset, size; if (!Block.PeekHeapValueOffsetAndSize(handle.GetHeapOffset(), out offset, out size)) { return string.Empty; } // Spec: Furthermore, there is an additional terminal byte (so all byte counts are odd, not even). // The size in the blob header is the length of the string in bytes + 1. return Block.PeekUtf16(offset, size & ~1); }