BinaryReader: Use cached default encoding instance (#8017)
authorJustin Van Patten <jvp@justinvp.com>
Thu, 10 Nov 2016 14:58:33 +0000 (06:58 -0800)
committerJan Kotas <jkotas@microsoft.com>
Thu, 10 Nov 2016 14:58:33 +0000 (06:58 -0800)
commit1b71a36e5fdfe8616271828b1c48cf5fe604d07f
treea4be8a8406a44348d5c656ce9fc23ce8f7a1ca6d
parente0622498d99d51f008e59dcc2ea8ec0301689bd8
BinaryReader: Use cached default encoding instance (#8017)

A new instance of UTF8Encoding used to be created every time
BinaryReader.ctor(Stream) was called, which created an instance of
UTF8Encoding that has no preamble. However, BinaryReader does not use
the preamble at all, so it doesn't matter if the encoding has a preamble
or not. Thus, the cached Encoding.UTF8 instance can be used (which has a
preamble).
src/mscorlib/src/System/IO/BinaryReader.cs