0

I know you can easily create a wrapper around BinaryReader and expose Read7BitEncodedInt But I'm just curious why the creators chose to not make it public

Is there a logic reason for it?

Pepernoot
  • 3,409
  • 3
  • 21
  • 46
  • It is a the simplest compression scheme with the lowest amount of overhead to decode: https://stackoverflow.com/questions/31501672/unusual-integer-encoding-to-bytes-what-scheme-is-this/31501941#31501941 Making it an implementation detail is essential to avoid anybody from assuming that one of the numerous ways to compress data is the Right Way. All that you care about is that the decoder matches the encoder. – Hans Passant Sep 14 '19 at 22:51

1 Answers1

1

My guess is that this is internal implementation detail and isn't required to effectively use the BinaryReader. I wonder the opposite, why isn't it private? Presumably, there is a subclass out there that needs to use it or overwrite the implementation...

Soc
  • 7,425
  • 4
  • 13
  • 30
  • 1
    There are [quite a few derived classes](https://referencesource.microsoft.com/#mscorlib/system/io/binaryreader.cs,4f6cad84482876ff,references) but none of them actually override it. – Scott Chamberlain Sep 14 '19 at 22:29
  • Makes sense... it's not `virtual` either. – Soc Sep 14 '19 at 22:35