mono/mono — pull request #559 by tomspilman (2013-02-12 03:39:01+00:00)
Title: Fix BinaryReader.ReadChars() To Match .NET Behavior

In Mono BinaryReader.ReadChars() recursively calls BinaryReader.Read().

This causes trouble if you are doing something like this...

```
public class CheckedBinaryWriter : BinaryWriter
{
public override void Write(char[] chars)
{
WriteType();
base.Write(chars);
}

public override void Write(char[] chars, int index, int count)
{
WriteType();
base.Write(chars, index, count);
}
}

public class CheckedBinaryReader : BinaryReader
{
public override int Read(char[] buffer, int index, int count)
{
ReadTypeAndCheck(); // FAIL!
return base.Read(buffer, index, count);
}

public override char[] ReadChars(int count)
{
ReadTypeAndCheck();
return base.ReadChars(count);
}
}
```

... because the writer and the reader do not make balanced calls.

This same code works in .NET because BinaryReader.ReadChars() does not recursively call BinaryReader.Read().

As a side effect the removal of recursion saves some more stack space and removes some unnecessary argument checks.

(This is my first commit to Mono... let me know if I have done something stupid!)