diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs
index ea84a9d718a..b084c3408ca 100644
--- a/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs
+++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/CimSessionProxy.cs
@@ -226,7 +226,7 @@ internal class CimSessionProxy : IDisposable
/// CimSession to be added
internal static void AddCimSessionToTemporaryCache(CimSession session)
{
- if (null != session)
+ if (session != null)
{
lock (temporarySessionCacheLock)
{
@@ -252,7 +252,7 @@ internal static void AddCimSessionToTemporaryCache(CimSession session)
private static void RemoveCimSessionFromTemporaryCache(CimSession session,
bool dispose)
{
- if (null != session)
+ if (session != null)
{
bool removed = false;
lock (temporarySessionCacheLock)
diff --git a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs
index 14f9c5f13c7..b4fa211dbef 100644
--- a/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs
+++ b/src/Microsoft.Management.Infrastructure.CimCmdlets/NewCimInstanceCommand.cs
@@ -317,15 +317,15 @@ protected override void ProcessRecord()
if (this.ClientOnly)
{
string conflictParameterName = null;
- if (null != this.ComputerName)
+ if (this.ComputerName != null)
{
conflictParameterName = @"ComputerName";
}
- else if (null != this.CimSession)
+ else if (this.CimSession != null)
{
conflictParameterName = @"CimSession";
}
- if (null != conflictParameterName)
+ if (conflictParameterName != null)
{
ThrowConflictParameterWasSet(@"New-CimInstance", conflictParameterName, @"ClientOnly");
return;
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs
index 1b88bd86822..39345c32092 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Eventlog.cs
@@ -403,7 +403,7 @@ private void Process(EventLog log)
+ ": " + e.Message);
throw;
}
- if ((null != entry) &&
+ if ((entry != null) &&
((lastindex == Int32.MinValue
|| lastindex - entry.Index == 1)))
{
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs
index 3e975299ba2..d495befe738 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Process.cs
@@ -170,7 +170,7 @@ private static int ProcessComparison(Process x, Process y)
///
private void RetrieveMatchingProcessesByProcessName()
{
- if (null == processNames)
+ if (processNames == null)
{
_matchingProcesses = new List(AllProcesses);
return;
@@ -211,7 +211,7 @@ private void RetrieveMatchingProcessesByProcessName()
///
private void RetrieveMatchingProcessesById()
{
- if (null == processIds)
+ if (processIds == null)
{
Diagnostics.Assert(false, "null processIds");
throw PSTraceSource.NewInvalidOperationException();
@@ -246,7 +246,7 @@ private void RetrieveMatchingProcessesById()
///
private void RetrieveProcessesByInput()
{
- if (null == InputObject)
+ if (InputObject == null)
{
Diagnostics.Assert(false, "null InputObject");
throw PSTraceSource.NewInvalidOperationException();
@@ -271,7 +271,7 @@ internal Process[] AllProcesses
{
get
{
- if (null == _allProcesses)
+ if (_allProcesses == null)
{
List processes = new List();
processes.AddRange(Process.GetProcesses());
@@ -347,7 +347,7 @@ internal void WriteNonTerminatingError(
string message = StringUtil.Format(resourceId,
processName,
processId,
- (null == innerException) ? string.Empty : innerException.Message);
+ (innerException == null) ? string.Empty : innerException.Message);
ProcessCommandException exception =
new ProcessCommandException(message, innerException);
exception.ProcessName = processName;
@@ -1406,7 +1406,7 @@ private void StopProcess(Process process)
exception = e;
}
- if (null != exception)
+ if (exception != null)
{
if (!TryHasExited(process))
{
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs
index d993091378d..54e117cdd7b 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/Service.cs
@@ -103,7 +103,7 @@ internal void WriteNonTerminatingError(
string message = StringUtil.Format(errorMessage,
serviceName,
displayName,
- (null == innerException) ? String.Empty : innerException.Message);
+ (innerException == null) ? String.Empty : innerException.Message);
var exception = new ServiceCommandException(message, innerException);
exception.ServiceName = serviceName;
@@ -261,7 +261,7 @@ internal ServiceController[] AllServices
{
get
{
- if (null == _allServices)
+ if (_allServices == null)
{
_allServices = ServiceController.GetServices();
}
@@ -339,7 +339,7 @@ private List MatchingServicesByServiceName()
{
List matchingServices = new List();
- if (null == serviceNames)
+ if (serviceNames == null)
{
foreach (ServiceController service in AllServices)
{
@@ -399,7 +399,7 @@ private List MatchingServicesByServiceName()
private List MatchingServicesByDisplayName()
{
List matchingServices = new List();
- if (null == DisplayName)
+ if (DisplayName == null)
{
Diagnostics.Assert(false, "null DisplayName");
throw PSTraceSource.NewInvalidOperationException();
@@ -439,7 +439,7 @@ private List MatchingServicesByDisplayName()
private List MatchingServicesByInput()
{
List matchingServices = new List();
- if (null == InputObject)
+ if (InputObject == null)
{
Diagnostics.Assert(false, "null InputObject");
throw PSTraceSource.NewInvalidOperationException();
@@ -466,9 +466,9 @@ private void IncludeExcludeAdd(
ServiceController service,
bool checkDuplicates)
{
- if (null != include && !Matches(service, include))
+ if (include != null && !Matches(service, include))
return;
- if (null != exclude && Matches(service, exclude))
+ if (exclude != null && Matches(service, exclude))
return;
if (checkDuplicates)
{
@@ -493,7 +493,7 @@ private void IncludeExcludeAdd(
///
private bool Matches(ServiceController service, string[] matchList)
{
- if (null == matchList)
+ if (matchList == null)
throw PSTraceSource.NewArgumentNullException("matchList");
string serviceID = (selectionMode == SelectionMode.DisplayName)
? service.DisplayName
@@ -846,13 +846,13 @@ internal bool DoStartService(ServiceController serviceController)
catch (InvalidOperationException e)
{
Win32Exception eInner = e.InnerException as Win32Exception;
- if (null == eInner
+ if (eInner == null
|| NativeMethods.ERROR_SERVICE_ALREADY_RUNNING != eInner.NativeErrorCode)
{
exception = e;
}
}
- if (null != exception)
+ if (exception != null)
{
// This service refused to accept the start command,
// so write a non-terminating error.
@@ -962,13 +962,13 @@ internal List DoStopService(ServiceController serviceControll
{
Win32Exception eInner =
e.InnerException as Win32Exception;
- if (null == eInner
+ if (eInner == null
|| NativeMethods.ERROR_SERVICE_NOT_ACTIVE != eInner.NativeErrorCode)
{
exception = e;
}
}
- if (null != exception)
+ if (exception != null)
{
// This service refused to accept the stop command,
// so write a non-terminating error.
@@ -1067,14 +1067,14 @@ internal bool DoPauseService(ServiceController serviceController)
catch (InvalidOperationException e)
{
Win32Exception eInner = e.InnerException as Win32Exception;
- if (null != eInner
+ if (eInner != null
&& NativeMethods.ERROR_SERVICE_NOT_ACTIVE == eInner.NativeErrorCode)
{
serviceNotRunning = true;
}
exception = e;
}
- if (null != exception)
+ if (exception != null)
{
// This service refused to accept the pause command,
// so write a non-terminating error.
@@ -1145,14 +1145,14 @@ internal bool DoResumeService(ServiceController serviceController)
catch (InvalidOperationException e)
{
Win32Exception eInner = e.InnerException as Win32Exception;
- if (null != eInner
+ if (eInner != null
&& NativeMethods.ERROR_SERVICE_NOT_ACTIVE == eInner.NativeErrorCode)
{
serviceNotRunning = true;
}
exception = e;
}
- if (null != exception)
+ if (exception != null)
{
// This service refused to accept the continue command,
// so write a non-terminating error.
@@ -1666,7 +1666,7 @@ protected override void ProcessRecord()
}
// Modify startup type or display name or credential
if (!String.IsNullOrEmpty(DisplayName)
- || ServiceStartupType.InvalidValue != StartupType || null != Credential)
+ || ServiceStartupType.InvalidValue != StartupType || Credential != null)
{
DWORD dwStartType = NativeMethods.SERVICE_NO_CHANGE;
if (!NativeMethods.TryGetNativeStartupType(StartupType, out dwStartType))
@@ -1679,7 +1679,7 @@ protected override void ProcessRecord()
}
string username = null;
- if (null != Credential)
+ if (Credential != null)
{
username = Credential.UserName;
password = Marshal.SecureStringToCoTaskMemUnicode(Credential.Password);
@@ -2024,7 +2024,7 @@ protected override void BeginProcessing()
}
// set up the double-null-terminated lpDependencies parameter
IntPtr lpDependencies = IntPtr.Zero;
- if (null != DependsOn)
+ if (DependsOn != null)
{
int numchars = 1; // final null
foreach (string dependedOn in DependsOn)
@@ -2052,7 +2052,7 @@ protected override void BeginProcessing()
// set up the Credential parameter
string username = null;
- if (null != Credential)
+ if (Credential != null)
{
username = Credential.UserName;
password = Marshal.SecureStringToCoTaskMemUnicode(Credential.Password);
diff --git a/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs b/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs
index ce34d32b69e..776dfe5c413 100644
--- a/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs
+++ b/src/Microsoft.PowerShell.Commands.Management/commands/management/TimeZoneCommands.cs
@@ -76,7 +76,7 @@ protected override void ProcessRecord()
}
else // ParameterSetName == "Name"
{
- if (null != Name)
+ if (Name != null)
{
// lookup each time zone name (or wildcard pattern)
foreach (string tzname in Name)
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs
index 4c0a67d7263..e31973bcb49 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/CSVCommands.cs
@@ -408,7 +408,7 @@ private void CreateFileStream()
_fs.Dispose();
_fs = null;
// reset the read-only attribute
- if (null != _readOnlyFileInfo)
+ if (_readOnlyFileInfo != null)
_readOnlyFileInfo.Attributes |= FileAttributes.ReadOnly;
}
if (_helper != null)
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs
index fa5764b5c7e..a0df0cc18e9 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ExportAliasCommand.cs
@@ -267,7 +267,7 @@ protected override void EndProcessing()
writer = OpenFile(out readOnlyFileInfo);
}
- if (null != writer)
+ if (writer != null)
WriteHeader(writer);
// Now write out the aliases
@@ -284,7 +284,7 @@ protected override void EndProcessing()
line = GetAliasLine(alias, "set-alias -Name:\"{0}\" -Value:\"{1}\" -Description:\"{2}\" -Option:\"{3}\"");
}
- if (null != writer)
+ if (writer != null)
writer.WriteLine(line);
if (PassThru)
@@ -295,10 +295,10 @@ protected override void EndProcessing()
}
finally
{
- if (null != writer)
+ if (writer != null)
writer.Dispose();
// reset the read-only attribute
- if (null != readOnlyFileInfo)
+ if (readOnlyFileInfo != null)
readOnlyFileInfo.Attributes |= FileAttributes.ReadOnly;
}
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OriginalColumnInfo.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OriginalColumnInfo.cs
index 395eaee2040..a02cf72f71a 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OriginalColumnInfo.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OriginalColumnInfo.cs
@@ -33,7 +33,7 @@ internal override Object GetValue(PSObject liveObject)
// The live object has the liveObjectPropertyName property.
Object liveObjectValue = propertyInfo.Value;
ICollection collectionValue = liveObjectValue as ICollection;
- if (null != collectionValue)
+ if (collectionValue != null)
{
liveObjectValue = _parentCmdlet.ConvertToString(PSObjectHelper.AsPSObject(propertyInfo.Value));
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
index adcf5f0c127..d2740b45390 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/OutWindowProxy.cs
@@ -56,15 +56,15 @@ internal OutWindowProxy(string title, OutputModeOption outPutMode, OutGridViewCo
/// An array of types to add.
internal void AddColumns(string[] propertyNames, string[] displayNames, Type[] types)
{
- if (null == propertyNames)
+ if (propertyNames == null)
{
throw new ArgumentNullException("propertyNames");
}
- if (null == displayNames)
+ if (displayNames == null)
{
throw new ArgumentNullException("displayNames");
}
- if (null == types)
+ if (types == null)
{
throw new ArgumentNullException("types");
}
@@ -173,7 +173,7 @@ private void AddExtraProperties(PSObject staleObject, PSObject liveObject)
///
internal void AddItem(PSObject livePSObject)
{
- if (null == livePSObject)
+ if (livePSObject == null)
{
throw new ArgumentNullException("livePSObject");
}
@@ -199,7 +199,7 @@ internal void AddItem(PSObject livePSObject)
///
internal void AddHeteroViewItem(PSObject livePSObject)
{
- if (null == livePSObject)
+ if (livePSObject == null)
{
throw new ArgumentNullException("livePSObject");
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs
index f828d1324de..acc7c41f459 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/OutGridView/TableView.cs
@@ -233,7 +233,7 @@ private List GetActiveTableRowDefinition(TableControlBod
if (matchingRowDefinition == null)
{
Collection typesWithoutPrefix = Deserializer.MaskDeserializationPrefix(typeNames);
- if (null != typesWithoutPrefix)
+ if (typesWithoutPrefix != null)
{
match = new TypeMatch(_expressionFactory, _typeInfoDatabase, typesWithoutPrefix);
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-file/Out-File.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-file/Out-File.cs
index 3ff84d55de9..1ec5748358c 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-file/Out-File.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/FormatAndOutput/out-file/Out-File.cs
@@ -166,7 +166,7 @@ protected override void BeginProcessing()
// cleanup code will be called in IDisposable.Dispose()
outInner.LineOutput = InstantiateLineOutputInterface();
- if (null == _sw)
+ if (_sw == null)
{
return;
}
@@ -226,7 +226,7 @@ private LineOutput InstantiateLineOutputInterface()
protected override void ProcessRecord()
{
_processRecordExecuted = true;
- if (null == _sw)
+ if (_sw == null)
{
return;
}
@@ -253,7 +253,7 @@ protected override void EndProcessing()
return;
}
- if (null == _sw)
+ if (_sw == null)
{
return;
}
@@ -285,7 +285,7 @@ private void CleanUp()
}
// reset the read-only attribute
- if (null != _readOnlyFileInfo)
+ if (_readOnlyFileInfo != null)
{
_readOnlyFileInfo.Attributes |= FileAttributes.ReadOnly;
_readOnlyFileInfo = null;
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs
index e59ceaa23a1..5d40a0b60ac 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetMember.cs
@@ -230,7 +230,7 @@ protected override void ProcessRecord()
if (!Force)
{
PSMethod memberAsPSMethod = member as PSMethod;
- if ((null != memberAsPSMethod) && (memberAsPSMethod.IsSpecial))
+ if ((memberAsPSMethod != null) && (memberAsPSMethod.IsSpecial))
{
continue;
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs
index d3cedd9a83e..38948659e3c 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/GetUnique.cs
@@ -57,7 +57,7 @@ public SwitchParameter OnType
protected override void ProcessRecord()
{
bool isUnique = true;
- if (null == _lastObject)
+ if (_lastObject == null)
{
// always write first object, but return nothing
// on "MSH> get-unique"
@@ -71,7 +71,7 @@ protected override void ProcessRecord()
else if (AsString)
{
string inputString = InputObject.ToString();
- if (null == _lastObjectAsString)
+ if (_lastObjectAsString == null)
{
_lastObjectAsString = _lastObject.ToString();
}
@@ -89,7 +89,7 @@ protected override void ProcessRecord()
}
else // compare as objects
{
- if (null == _comparer)
+ if (_comparer == null)
{
_comparer = new ObjectCommandComparer(
true, // ascending (doesn't matter)
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs
index f9394ffcebf..82bcc6e74ae 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ImplicitRemotingCommands.cs
@@ -2536,7 +2536,7 @@ private string GenerateNewRunspaceExpression()
private string GenerateConnectionStringForNewRunspace()
{
WSManConnectionInfo connectionInfo = _remoteRunspaceInfo.Runspace.ConnectionInfo as WSManConnectionInfo;
- if (null == connectionInfo)
+ if (connectionInfo == null)
{
VMConnectionInfo vmConnectionInfo = _remoteRunspaceInfo.Runspace.ConnectionInfo as VMConnectionInfo;
if (vmConnectionInfo != null)
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/InvokeCommandCmdlet.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/InvokeCommandCmdlet.cs
index 7c751922b4d..0c96cf663bd 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/InvokeCommandCmdlet.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/InvokeCommandCmdlet.cs
@@ -30,7 +30,7 @@ public sealed
///
protected override void ProcessRecord()
{
- Diagnostics.Assert(null != Command, "Command is null");
+ Diagnostics.Assert(Command != null, "Command is null");
ScriptBlock myScriptBlock = InvokeCommand.NewScriptBlock(Command);
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs
index 894eda444d0..1e3a570eb21 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/Measure-Object.cs
@@ -884,11 +884,11 @@ private MeasureInfo CreateGenericMeasureInfo(Statistics stat, bool shouldUseGene
gmi.Sum = sum;
gmi.Average = average;
gmi.StandardDeviation = StandardDeviation;
- if (null != max)
+ if (max != null)
{
gmi.Maximum = (double)max;
}
- if (null != min)
+ if (min != null)
{
gmi.Minimum = (double)min;
}
diff --git a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandCommandInfo.cs b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandCommandInfo.cs
index fc02201d3fa..a86bd31916a 100644
--- a/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandCommandInfo.cs
+++ b/src/Microsoft.PowerShell.Commands.Utility/commands/utility/ShowCommand/ShowCommandCommandInfo.cs
@@ -22,7 +22,7 @@ public class ShowCommandCommandInfo
///
public ShowCommandCommandInfo(CommandInfo other)
{
- if (null == other)
+ if (other == null)
{
throw new ArgumentNullException("other");
}
@@ -71,7 +71,7 @@ public ShowCommandCommandInfo(CommandInfo other)
///
public ShowCommandCommandInfo(PSObject other)
{
- if (null == other)
+ if (other == null)
{
throw new ArgumentNullException("other");
}
@@ -146,4 +146,4 @@ internal static IEnumerable