From: Justin Van Patten Date: Thu, 10 Nov 2016 04:05:11 +0000 (-0800) Subject: Avoid repeated delegate allocations in FileStream.FlushAsync (#8048) X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d19d2e7d57deee034650a8cc078c4ad93ce03c8;p=platform%2Fupstream%2Fcoreclr.git Avoid repeated delegate allocations in FileStream.FlushAsync (#8048) Avoid the `Action` allocation on each invocation of `FileStream.FlushAsync` on Windows. This change makes the Win32 implementation match Unix. --- diff --git a/src/mscorlib/corefx/System/IO/FileStream.Win32.cs b/src/mscorlib/corefx/System/IO/FileStream.Win32.cs index 8b9adb5436..350d948b00 100644 --- a/src/mscorlib/corefx/System/IO/FileStream.Win32.cs +++ b/src/mscorlib/corefx/System/IO/FileStream.Win32.cs @@ -1715,7 +1715,7 @@ namespace System.IO if (CanWrite) { return Task.Factory.StartNew( - state => FlushOSBuffer(), + state => ((FileStream)state).FlushOSBuffer(), this, cancellationToken, TaskCreationOptions.DenyChildAttach,