Use null check with pattern-matching instead of object.ReferenceEquals (#13065)

This commit is contained in:
xtqqczze 2020-07-06 17:51:24 +01:00 committed by GitHub
parent babf02768b
commit 9aba45f18c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 6 additions and 6 deletions

View file

@ -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;
}}

View file

@ -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) &&

View file

@ -1946,7 +1946,7 @@ namespace System.Management.Automation
public bool Equals(PSMethodInvocationConstraints other)
{
if (ReferenceEquals(null, other))
if (other is null)
{
return false;
}

View file

@ -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);

View file

@ -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);
}