You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Add docs on ExtendedLayout
Fixes#51746
Add description of the `ExtendedLayoutAttribute` in the language attributes section.
* Update docs/csharp/language-reference/attributes/general.md
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
* Apply suggestion from @BillWagner
---------
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/attributes/general.md
+12-1Lines changed: 12 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "Attributes interpreted by the compiler: Miscellaneous"
3
-
ms.date: 01/14/2026
3
+
ms.date: 02/17/2026
4
4
description: "Learn about attributes that affect code generated by the compiler: the Conditional, Obsolete, AttributeUsage, ModuleInitializer, and SkipLocalsInit attributes."
5
5
---
6
6
# Miscellaneous attributes interpreted by the C# compiler
@@ -26,6 +26,7 @@ You can apply several attributes to elements in your code to add semantic meanin
26
26
-[`InlineArray`](#inlinearray-attribute): Specify that a `struct` type is an *inline array*.
27
27
-[`IUnknownConstant`](#iunknownconstant-and-idispatchconstant-attributes): Specifies how a missing argument should be supplied for a default parameter.
28
28
-[`IDispatchConstant`](#iunknownconstant-and-idispatchconstant-attributes): Specifies how a missing argument should be supplied for a default parameter.
29
+
-[`ExtendedLayoutAttribute`](#extendedlayout-attribute): Instructs the compiler to set the `ExtendedLayout` flag in the type's metadata.
29
30
30
31
The compiler uses those semantic meanings to alter its output and report possible mistakes by developers using your code.
31
32
@@ -273,6 +274,16 @@ The <xref:System.Runtime.CompilerServices.CollectionBuilderAttribute?displayProp
273
274
274
275
The <xref:System.Runtime.CompilerServices.InlineArrayAttribute?displayProperty=nameWithType> attribute marks a type as an [inline array](../builtin-types/struct.md#inline-arrays). You can learn more about this feature in the article on `structs`, in the section on [inline arrays](../builtin-types/struct.md#inline-arrays).
275
276
277
+
> [!IMPORTANT]
278
+
> This attribute can't be combined with the [`ExtendedLayout`](#extendedlayout-attribute) attribute.
279
+
280
+
## ExtendedLayout attribute
281
+
282
+
The <xref:System.Runtime.InteropServices.ExtendedLayoutAttribute?displayProperty=nameWithType> instructs the compiler to set the <xref:System.Reflection.TypeAttributes.ExtendedLayout?displayProperty=nameWithType> flag in the type's <xref:System.Type.Attributes?displayProperty=nameWithType> flags.
283
+
284
+
> [!IMPORTANT]
285
+
> This attribute can't be combined with the [`StructLayoutAttribute`](pseudo-attributes.md) or the [`InlineArray`](#inlinearray-attribute) attribute.
286
+
276
287
## IUnknownConstant and IDispatchConstant attributes
277
288
278
289
The <xref:System.Runtime.CompilerServices.IUnknownConstantAttribute?displayProperty=nameWithType> and <xref:System.Runtime.CompilerServices.IDispatchConstantAttribute?displayProperty=nameWithType> attributes can be added to default parameters to indicate that a missing argument should be supplied as `new UnknownWrapper(null)` or `new DispatchWrapper(null)`.
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/attributes/pseudo-attributes.md
+4-1Lines changed: 4 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
---
2
2
title: "Attributes interpreted by the compiler: Pseudo-attributes"
3
-
ms.date: 01/14/2026
3
+
ms.date: 02/17/2026
4
4
description: "Learn about attributes you can add to code that are written to IL as modifiers. These custom attributes aren't emitted as attributes in the compiled output."
5
5
---
6
6
# Custom attributes that generate flags or options in the Intermediate Language (IL) output
@@ -23,6 +23,9 @@ Add these attributes to your code for the compiler to emit a specified Intermedi
23
23
|<xref:System.Runtime.InteropServices.StructLayoutAttribute?displayProperty=fullName>|`auto`, `sequential`, or `explicit`| Layout options can be set using the parameters. |
24
24
|<xref:System.Runtime.CompilerServices.IndexerNameAttribute?displayProperty=fullName>|| Add this attribute to an indexer to set a different method name. By default, indexers are compiled to a property named `Item`. You can specify a different name using this attribute. |
25
25
26
+
> [!IMPORTANT]
27
+
> The [`StructLayoutAttribute`] can't be combined with the [`ExtendedLayout`](general.md#extendedlayout-attribute) attribute.
28
+
26
29
Some of these custom attributes are applied by using other C# syntax rather than adding the attribute to your source code.
0 commit comments