summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Ayers <andya@microsoft.com>2016-11-29 19:00:26 -0800
committerJan Kotas <jkotas@microsoft.com>2016-11-29 19:00:26 -0800
commit85a1a1d4e981e184f2f5d91c41a4d3be2a4ea3fa (patch)
tree8ab553d1ab343f3da1940d086a659cde80360572
parentdefed5e515109252cef6e000ffb4139424ae89f6 (diff)
downloadcoreclr-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.cs2
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"));
}