Reads and returns data of type from the message. UTF-16 encoded.
()
| 251 | /// Reads and returns data of type <see cref="string"/> from the message. UTF-16 encoded. |
| 252 | /// </summary> |
| 253 | public string ReadString() |
| 254 | { |
| 255 | // Note: Make sure that this is consistent with the C++ message API! |
| 256 | var stringLength = ReadInt32(); |
| 257 | if (stringLength == 0) |
| 258 | return string.Empty; |
| 259 | var dataLength = stringLength * sizeof(char); |
| 260 | var bytes = stackalloc char[stringLength]; |
| 261 | ReadBytes((byte*)bytes, dataLength); |
| 262 | return new string(bytes, 0, stringLength); |
| 263 | } |
| 264 | |
| 265 | /// <summary> |
| 266 | /// Writes data of type <see cref="Guid"/> into the message. |