Skip to content

Commit dafcf24

Browse files
authored
Revert "Use is null syntax (#13277)"
This reverts commit 6c03776.
1 parent fd05d1a commit dafcf24

581 files changed

Lines changed: 5031 additions & 5031 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

src/Microsoft.Management.Infrastructure.CimCmdlets/CimAsyncOperation.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ protected void AddCimSessionProxy(CimSessionProxy sessionproxy)
207207
{
208208
lock (cimSessionProxyCacheLock)
209209
{
210-
if (this.cimSessionProxyCache is null)
210+
if (this.cimSessionProxyCache == null)
211211
{
212212
this.cimSessionProxyCache = new List<CimSessionProxy>();
213213
}
@@ -349,15 +349,15 @@ protected virtual void SubscribeToCimSessionProxyEvent(CimSessionProxy proxy)
349349
protected object GetBaseObject(object value)
350350
{
351351
PSObject psObject = value as PSObject;
352-
if (psObject is null)
352+
if (psObject == null)
353353
{
354354
return value;
355355
}
356356
else
357357
{
358358
object baseObject = psObject.BaseObject;
359359
var arrayObject = baseObject as object[];
360-
if (arrayObject is null)
360+
if (arrayObject == null)
361361
{
362362
return baseObject;
363363
}
@@ -389,7 +389,7 @@ protected object GetReferenceOrReferenceArrayObject(object value, ref CimType re
389389
{
390390
object baseObject = GetBaseObject(cimReference.Value);
391391
CimInstance cimInstance = baseObject as CimInstance;
392-
if (cimInstance is null)
392+
if (cimInstance == null)
393393
{
394394
return null;
395395
}
@@ -400,7 +400,7 @@ protected object GetReferenceOrReferenceArrayObject(object value, ref CimType re
400400
else
401401
{
402402
object[] cimReferenceArray = value as object[];
403-
if (cimReferenceArray is null)
403+
if (cimReferenceArray == null)
404404
{
405405
return null;
406406
}
@@ -413,14 +413,14 @@ protected object GetReferenceOrReferenceArrayObject(object value, ref CimType re
413413
for (int i = 0; i < cimReferenceArray.Length; i++)
414414
{
415415
PSReference tempCimReference = cimReferenceArray[i] as PSReference;
416-
if (tempCimReference is null)
416+
if (tempCimReference == null)
417417
{
418418
return null;
419419
}
420420

421421
object baseObject = GetBaseObject(tempCimReference.Value);
422422
cimInstanceArray[i] = baseObject as CimInstance;
423-
if (cimInstanceArray[i] is null)
423+
if (cimInstanceArray[i] == null)
424424
{
425425
return null;
426426
}

src/Microsoft.Management.Infrastructure.CimCmdlets/CimCommandBase.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,7 @@ internal void SetParameter(string parameterName, bool isBeginProcess)
336336
{
337337
DebugHelper.WriteLogEx("parameterset name = '{0}'; mandatory = '{1}'", 1, parameterDefinitionEntry.ParameterSetName, parameterDefinitionEntry.IsMandatory);
338338
ParameterSetEntry psEntry = this.parameterSetEntries[parameterDefinitionEntry.ParameterSetName];
339-
if (psEntry is null)
339+
if (psEntry == null)
340340
continue;
341341

342342
if (parameterDefinitionEntry.IsMandatory)
@@ -460,7 +460,7 @@ internal string GetParameterSet()
460460
}
461461

462462
// Looking for parameter set which has no mandatory parameters
463-
if (boundParameterSetName is null)
463+
if (boundParameterSetName == null)
464464
{
465465
// throw if there are > 1 parameter set
466466
if (noMandatoryParameterSet.Count > 1)
@@ -474,13 +474,13 @@ internal string GetParameterSet()
474474
}
475475

476476
// Looking for default parameter set
477-
if (boundParameterSetName is null)
477+
if (boundParameterSetName == null)
478478
{
479479
boundParameterSetName = defaultParameterSetName;
480480
}
481481

482482
// throw if still can not find the parameter set name
483-
if (boundParameterSetName is null)
483+
if (boundParameterSetName == null)
484484
{
485485
throw new PSArgumentException(CimCmdletStrings.UnableToResolveParameterSetName);
486486
}
@@ -552,7 +552,7 @@ internal void SetParameter(object value, string parameterName)
552552
// Null value could be set by caller unintentionally,
553553
// or by powershell to reset the parameter to default value
554554
// before the next parameter binding, and ProcessRecord call
555-
if (value is null)
555+
if (value == null)
556556
{
557557
return;
558558
}
@@ -731,7 +731,7 @@ internal CimAsyncOperation AsyncOperation
731731
{
732732
lock (this.myLock)
733733
{
734-
Debug.Assert(this.operation is null, "Caller should verify that operation is null");
734+
Debug.Assert(this.operation == null, "Caller should verify that operation is null");
735735
this.operation = value;
736736
}
737737
}

src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetAssociatedInstance.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ public void GetCimAssociatedInstance(GetCimAssociatedInstanceCommand cmdlet)
3939
IEnumerable<string> computerNames = ConstValue.GetComputerNames(cmdlet.ComputerName);
4040
// use the namespace from parameter
4141
string nameSpace = cmdlet.Namespace;
42-
if ((nameSpace is null) && (cmdlet.ResourceUri is null))
42+
if ((nameSpace == null) && (cmdlet.ResourceUri == null))
4343
{
4444
// try to use namespace of ciminstance, then fall back to default namespace
4545
nameSpace = ConstValue.GetNamespace(cmdlet.CimInstance.CimSystemProperties.Namespace);

src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetCimClass.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public void GetCimClass(GetCimClassCommand cmdlet)
126126
{
127127
List<CimSessionProxy> proxys = new List<CimSessionProxy>();
128128
string nameSpace = ConstValue.GetNamespace(cmdlet.Namespace);
129-
string className = (cmdlet.ClassName is null) ? @"*" : cmdlet.ClassName;
129+
string className = (cmdlet.ClassName == null) ? @"*" : cmdlet.ClassName;
130130
CimGetCimClassContext context = new CimGetCimClassContext(
131131
cmdlet.ClassName,
132132
cmdlet.MethodName,

src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ protected static string CreateQuery(CimBaseCommand cmdlet)
304304
if (cmd != null)
305305
{
306306
StringBuilder propertyList = new StringBuilder();
307-
if (cmd.SelectProperties is null)
307+
if (cmd.SelectProperties == null)
308308
{
309309
propertyList.Append("*");
310310
}
@@ -321,7 +321,7 @@ protected static string CreateQuery(CimBaseCommand cmdlet)
321321
}
322322
}
323323

324-
return (cmd.Filter is null) ?
324+
return (cmd.Filter == null) ?
325325
string.Format(CultureInfo.CurrentUICulture, queryWithoutWhere, propertyList, cmd.ClassName) :
326326
string.Format(CultureInfo.CurrentUICulture, queryWithWhere, propertyList, cmd.ClassName, cmd.Filter);
327327
}

src/Microsoft.Management.Infrastructure.CimCmdlets/CimIndicationWatcher.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ public CimInstance NewEvent
8181
{
8282
get
8383
{
84-
return (result is null) ? null : result.Instance;
84+
return (result == null) ? null : result.Instance;
8585
}
8686
}
8787

@@ -92,7 +92,7 @@ public string MachineId
9292
{
9393
get
9494
{
95-
return (result is null) ? null : result.MachineId;
95+
return (result == null) ? null : result.MachineId;
9696
}
9797
}
9898

@@ -103,7 +103,7 @@ public string Bookmark
103103
{
104104
get
105105
{
106-
return (result is null) ? null : result.Bookmark;
106+
return (result == null) ? null : result.Bookmark;
107107
}
108108
}
109109

@@ -292,7 +292,7 @@ public void Start()
292292
{
293293
if (status == Status.Default)
294294
{
295-
if (this.cimSession is null)
295+
if (this.cimSession == null)
296296
{
297297
cimRegisterCimIndication.RegisterCimIndication(
298298
this.computerName,

src/Microsoft.Management.Infrastructure.CimCmdlets/CimInvokeCimMethod.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ private CimMethodParametersCollection CreateParametersCollection(
359359
DebugHelper.WriteLogEx();
360360

361361
CimMethodParametersCollection collection = null;
362-
if (parameters is null)
362+
if (parameters == null)
363363
{
364364
return collection;
365365
}
@@ -389,7 +389,7 @@ private CimMethodParametersCollection CreateParametersCollection(
389389
{
390390
className = cimClass.CimSystemProperties.ClassName;
391391
declaration = cimClass.CimClassMethods[methodName];
392-
if (declaration is null)
392+
if (declaration == null)
393393
{
394394
throw new ArgumentException(string.Format(
395395
CultureInfo.CurrentUICulture, CimCmdletStrings.InvalidMethod, methodName, className));
@@ -404,7 +404,7 @@ private CimMethodParametersCollection CreateParametersCollection(
404404
if (declaration != null)
405405
{
406406
CimMethodParameterDeclaration paramDeclaration = declaration.Parameters[parameterName];
407-
if (paramDeclaration is null)
407+
if (paramDeclaration == null)
408408
{
409409
throw new ArgumentException(string.Format(
410410
CultureInfo.CurrentUICulture, CimCmdletStrings.InvalidMethodParameter, parameterName, methodName, className));
@@ -420,7 +420,7 @@ private CimMethodParametersCollection CreateParametersCollection(
420420
}
421421
else
422422
{
423-
if (parameterValue is null)
423+
if (parameterValue == null)
424424
{
425425
// try the best to get the type while value is null
426426
parameter = CimMethodParameter.Create(

src/Microsoft.Management.Infrastructure.CimCmdlets/CimNewCimInstance.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -181,14 +181,14 @@ internal void GetCimInstance(CimInstance cimInstance, XOperationContextBase cont
181181
DebugHelper.WriteLogEx();
182182

183183
CimNewCimInstanceContext newCimInstanceContext = context as CimNewCimInstanceContext;
184-
if (newCimInstanceContext is null)
184+
if (newCimInstanceContext == null)
185185
{
186186
DebugHelper.WriteLog("Invalid (null) CimNewCimInstanceContext", 1);
187187
return;
188188
}
189189

190190
CimSessionProxy proxy = CreateCimSessionProxy(newCimInstanceContext.Proxy);
191-
string nameSpace = (cimInstance.CimSystemProperties.Namespace is null) ? newCimInstanceContext.Namespace : cimInstance.CimSystemProperties.Namespace;
191+
string nameSpace = (cimInstance.CimSystemProperties.Namespace == null) ? newCimInstanceContext.Namespace : cimInstance.CimSystemProperties.Namespace;
192192
proxy.GetInstanceAsync(nameSpace, cimInstance);
193193
}
194194

@@ -268,7 +268,7 @@ private CimInstance CreateCimInstance(
268268
NewCimInstanceCommand cmdlet)
269269
{
270270
CimInstance cimInstance = new CimInstance(className, cimNamespace);
271-
if (properties is null)
271+
if (properties == null)
272272
{
273273
return cimInstance;
274274
}
@@ -332,15 +332,15 @@ private CimInstance CreateCimInstance(
332332
NewCimInstanceCommand cmdlet)
333333
{
334334
CimInstance cimInstance = new CimInstance(cimClass);
335-
if (properties is null)
335+
if (properties == null)
336336
{
337337
return cimInstance;
338338
}
339339

340340
List<string> notfoundProperties = new List<string>();
341341
foreach (string property in properties.Keys)
342342
{
343-
if (cimInstance.CimInstanceProperties[property] is null)
343+
if (cimInstance.CimInstanceProperties[property] == null)
344344
{
345345
notfoundProperties.Add(property);
346346
cmdlet.ThrowInvalidProperty(notfoundProperties, cmdlet.CimClass.CimSystemProperties.ClassName, @"Property", action, properties);

src/Microsoft.Management.Infrastructure.CimCmdlets/CimRegisterCimIndication.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public void RegisterCimIndication(
167167
UInt32 operationTimeout)
168168
{
169169
DebugHelper.WriteLogEx("queryDialect = '{0}'; queryExpression = '{1}'", 0, queryDialect, queryExpression);
170-
if (cimSession is null)
170+
if (cimSession == null)
171171
{
172172
throw new ArgumentNullException(string.Format(CultureInfo.CurrentUICulture, CimCmdletStrings.NullArgument, @"cimSession"));
173173
}

src/Microsoft.Management.Infrastructure.CimCmdlets/CimResultObserver.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -331,7 +331,7 @@ public virtual void OnNext(T value)
331331
{
332332
DebugHelper.WriteLogEx("value = {0}.", 1, value);
333333
// do not allow null value
334-
if (value is null)
334+
if (value == null)
335335
{
336336
return;
337337
}

0 commit comments

Comments
 (0)