I bet that Marshal.StringToHGlobalUni()they Marshal.FreeHGlobal(new IntPtr(Base))have a lot in common with the differences. I'm not sure how StringReader manages the string, but I'm sure that it does not copy it to unmanaged memory.
Looking at the StringReader.Read () method in Reflector, this shows:
public override int Read()
{
if (this._s == null)
{
__Error.ReaderClosed();
}
if (this._pos == this._length)
{
return -1;
}
return this._s[this._pos++];
}
The contractor is also fair:
public StringReader(string s)
{
if (s == null)
{
throw new ArgumentNullException("s");
}
this._s = s;
this._length = (s == null) ? 0 : s.Length;
}
, , StringReader .
Edit
Next() , , , . StringReader.Read() _pos , , , .