diff --git a/src/System.Private.CoreLib/shared/System/Object.cs b/src/System.Private.CoreLib/shared/System/Object.cs index 65e186ca49c0..10af793ca6ab 100644 --- a/src/System.Private.CoreLib/shared/System/Object.cs +++ b/src/System.Private.CoreLib/shared/System/Object.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; @@ -44,12 +45,12 @@ public virtual string ToString() // Equal to this. Equality is defined as object equality for reference // types and bitwise equality for value types using a loader trick to // replace Equals with EqualsValue for value types). - public virtual bool Equals(object obj) + public virtual bool Equals(object? obj) { return RuntimeHelpers.Equals(this, obj); } - public static bool Equals(object objA, object objB) + public static bool Equals(object? objA, object? objB) { if (objA == objB) { @@ -63,7 +64,7 @@ public static bool Equals(object objA, object objB) } [NonVersionable] - public static bool ReferenceEquals(object objA, object objB) + public static bool ReferenceEquals(object? objA, object? objB) { return objA == objB; } diff --git a/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs b/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs index fc361bcf2072..f6eaf61c1cd2 100644 --- a/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs +++ b/src/System.Private.CoreLib/src/System/Object.CoreCLR.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. +#nullable enable using System.Runtime.CompilerServices; namespace System