MongoDB.Driver.BsonReader.ReadShortString C# (CSharp) Method

ReadShortString() public method

Reads a string of unknown length but less than 1024 bytes
In the BSON spec there are two cases where the string length is not given: Element names of objects and regex strings. Since element names are very common, and are most likely short this method WILL FAIL unappologetically for strings longer than 1024 bytes. You have been warned!
public ReadShortString ( ) : string
return string
        public string ReadShortString()
        {
            int i = -1;
              do
              {
            Read(_byteBuffer, 0, 1);
            _stringBuffer[++i] = _byteBuffer[0];
              }
              while (_stringBuffer[i] != 0);
              return encoding.GetString(_stringBuffer, 0, i);
        }