Remove redundant delegate creation (#13441)

This commit is contained in:
xtqqczze authored and GitHub committed 2020-08-19 09:15:07 -07:00
1 parent ac5f5f9f22
commit 1a0a5db069
3 files changed
+4 -4

No files matched your search

@@ -131,7 +131,7 @@ namespace Microsoft.PowerShell.Commands.Internal.Format
}
// set up the callback mechanism
pd.PrintPage += new PrintPageEventHandler(this.pd_PrintPage);
pd.PrintPage += this.pd_PrintPage;
// start printing
pd.Print();
@@ -1682,7 +1682,7 @@ namespace Microsoft.PowerShell.Commands
powerShell.AddParameter("ArgumentList", this.ArgumentList);
powerShell.Runspace = Session.Runspace;
powerShell.RemotePowerShell.HostCallReceived += new EventHandler<RemoteDataEventArgs<RemoteHostCall>>(HandleHostCallReceived);
powerShell.RemotePowerShell.HostCallReceived += HandleHostCallReceived;
return powerShell;
}
@@ -278,8 +278,8 @@ namespace Microsoft.PowerShell.Commands
// errors are not created here, because there is a field for it used in the final pop up
PSDataCollection<object> output = new PSDataCollection<object>();
output.DataAdded += new EventHandler<DataAddedEventArgs>(this.Output_DataAdded);
_errors.DataAdded += new EventHandler<DataAddedEventArgs>(this.Error_DataAdded);
output.DataAdded += this.Output_DataAdded;
_errors.DataAdded += this.Error_DataAdded;
System.Management.Automation.PowerShell ps = System.Management.Automation.PowerShell.Create(RunspaceMode.CurrentRunspace);
ps.Streams.Error = _errors;