diff options
author | Andy Ayers <andya@microsoft.com> | 2016-11-29 19:00:26 -0800 |
---|---|---|
committer | Jan Kotas <jkotas@microsoft.com> | 2016-11-29 19:00:26 -0800 |
commit | 85a1a1d4e981e184f2f5d91c41a4d3be2a4ea3fa (patch) | |
tree | 8ab553d1ab343f3da1940d086a659cde80360572 | |
parent | defed5e515109252cef6e000ffb4139424ae89f6 (diff) | |
download | coreclr-85a1a1d4e981e184f2f5d91c41a4d3be2a4ea3fa.tar.gz coreclr-85a1a1d4e981e184f2f5d91c41a4d3be2a4ea3fa.tar.bz2 coreclr-85a1a1d4e981e184f2f5d91c41a4d3be2a4ea3fa.zip |
Remove one virtual call from StreamHelpers.ValidateCopyToArgs (#8361)
Check CanWrite on the destination stream first.
In the common case CanWrite is true, and CanRead is only needed to
determine which kind of exception to throw when CanWrite is false.
-rw-r--r-- | src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs b/src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs index 6cce13d104..8ff0e045ca 100644 --- a/src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs +++ b/src/mscorlib/src/System/IO/StreamHelpers.CopyValidation.cs @@ -27,7 +27,7 @@ namespace System.IO } bool destinationCanWrite = destination.CanWrite; - if (!destination.CanRead && !destinationCanWrite) + if (!destinationCanWrite && !destination.CanRead) { throw new ObjectDisposedException(nameof(destination), Environment.GetResourceString("ObjectDisposed_StreamClosed")); } |