Hello all.
I found some significant issues in C# decompilation that prevents from understanding code
Here is one of them.
Assembly: mscorlib, Version=4.0.0.0
Declaring Type: System.IO.StringReader
Method: public override string ReadLine();
Original code taken from
http://referencesource.microsoft.com/#mscorlib/system/io/stringreader.cs
// Reads a line. A line is defined as a sequence of characters followed by
// a carriage return ('
'), a line feed ('
'), or a carriage return
// immediately followed by a line feed. The resulting string does not
// contain the terminating carriage return and/or line feed. The returned
// value is null if the end of the underlying string has been reached.
//
public override String ReadLine() {
if (_s == null)
__Error.ReaderClosed();
int i = _pos;
while (i < _length) {
char ch = _s[i];
if (ch == '
' || ch == '
') {
String result = _s.Substring(_pos, i - _pos);
_pos = i + 1;
if (ch == '
' && _pos < _length && _s[_pos] == '
') _pos++;
return result;
}
i++;
}
if (i > _pos) {
String result = _s.Substring(_pos, i - _pos);
_pos = i;
return result;
}
return null;
}
Decompiled code
public override string ReadLine()
{
if (this._s == null)
{
__Error.ReaderClosed();
}
int num = this._pos;
while (num < this._length)
{
char ch = this._s[num];
switch (ch)
{
case '
':
case '
':
this._pos = num + 1;
if (((ch == '
') && (this._pos < this._length)) && (this._s[this._pos] == '
'))
{
this._pos++;
}
return this._s.Substring(this._pos, num - this._pos);
}
num++;
}
if (num > this._pos)
{
this._pos = num;
return this._s.Substring(this._pos, num - this._pos);
}
return null;
}
I found some significant issues in C# decompilation that prevents from understanding code
Here is one of them.
Assembly: mscorlib, Version=4.0.0.0
Declaring Type: System.IO.StringReader
Method: public override string ReadLine();
Original code taken from http://referencesource.microsoft.com/#mscorlib/system/io/stringreader.cs
Decompiled code