mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Use null check with pattern-matching instead of object.ReferenceEquals (#13065)
This commit is contained in:
@@ -147,7 +147,7 @@ using System.Reflection;
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
{4} static global::System.Resources.ResourceManager ResourceManager {{
|
||||
get {{
|
||||
if (object.ReferenceEquals(resourceMan, null)) {{
|
||||
if (resourceMan is null) {{
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager(""{1}.resources.{5}{3}"", typeof({0}).Assembly);
|
||||
resourceMan = temp;
|
||||
}}
|
||||
|
||||
@@ -1606,7 +1606,7 @@ namespace System.Management.Automation
|
||||
if (object.ReferenceEquals(x, y)) return true;
|
||||
|
||||
// Check whether any of the compared objects is null.
|
||||
if (object.ReferenceEquals(x, null) || Object.ReferenceEquals(y, null))
|
||||
if (x is null || y is null)
|
||||
return false;
|
||||
|
||||
bool result = string.Equals(x.Name, y.Name, StringComparison.OrdinalIgnoreCase) &&
|
||||
|
||||
@@ -1946,7 +1946,7 @@ namespace System.Management.Automation
|
||||
|
||||
public bool Equals(PSMethodInvocationConstraints other)
|
||||
{
|
||||
if (ReferenceEquals(null, other))
|
||||
if (other is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -907,9 +907,9 @@ namespace System.Management.Automation
|
||||
/// </summary>
|
||||
public static bool operator ==(SemanticVersion v1, SemanticVersion v2)
|
||||
{
|
||||
if (object.ReferenceEquals(v1, null))
|
||||
if (v1 is null)
|
||||
{
|
||||
return object.ReferenceEquals(v2, null);
|
||||
return v2 is null;
|
||||
}
|
||||
|
||||
return v1.Equals(v2);
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace System.Management.Automation.Tracing
|
||||
{
|
||||
get
|
||||
{
|
||||
if (object.ReferenceEquals(_resourceManager, null))
|
||||
if (_resourceManager is null)
|
||||
{
|
||||
_resourceManager = new global::System.Resources.ResourceManager("System.Management.Automation.resources.EventResource", typeof(EventResource).Assembly);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user