diff --git a/xml/System.Runtime.CompilerServices/InlineArrayAttribute.xml b/xml/System.Runtime.CompilerServices/InlineArrayAttribute.xml index 78df6f99eeb..27ed5cb955d 100644 --- a/xml/System.Runtime.CompilerServices/InlineArrayAttribute.xml +++ b/xml/System.Runtime.CompilerServices/InlineArrayAttribute.xml @@ -26,7 +26,18 @@ Indicates that the instance's storage is sequentially replicated times. - This attribute can be used to annotate a type with a single field. The runtime replicates that field in the actual type layout as many times as is specified. + + [!IMPORTANT] +> .NET 9 and later, the default implementations of `Equals()` and `GetHashCode()` for types marked with this attribute throw . You must override both and if they will be used. + + ]]> + The following example shows how to declare an inline array type with eight values. [InlineArray(8)] diff --git a/xml/System/ValueType.xml b/xml/System/ValueType.xml index 3d451acb079..3e3df37fd1a 100644 --- a/xml/System/ValueType.xml +++ b/xml/System/ValueType.xml @@ -200,7 +200,9 @@ The m The default implementation calls on each field of the current instance and `obj` and returns `true` if all fields are equal. -> [!TIP] +.NET 9 and later, the default implementation of throws if is applied to the type. + +> [!IMPORTANT] > Particularly if your value type contains fields that are reference types, you should override the method. This can improve performance and enable you to more closely represent the meaning of equality for the type. ## Notes for the Windows Runtime @@ -274,6 +276,8 @@ The method applies to types derived from For more information, see , and . +.NET 9 and later, the default implementation of throws if is applied to the type. + ## Notes for the Windows Runtime When you call the method on a Windows Runtime structure, it provides the default behavior for value types that don't override . This is part of the support that .NET provides for the Windows Runtime (see [.NET Support for Windows Store Apps and Windows Runtime](/dotnet/standard/cross-platform/support-for-windows-store-apps-and-windows-runtime)). Windows Runtime structures can't override , even if they're written with C# or Visual Basic, because they can't have methods. (In addition, structures in the Windows Runtime itself don't inherit .) However, they appear to have , , and methods when you use them in your C# or Visual Basic code, and .NET provides the default behavior for these methods.