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
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/attributes/pseudo-attributes.md
+6-6Lines changed: 6 additions & 6 deletions
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/2/2025
3
+
ms.date: 01/28/2025
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
@@ -16,7 +16,6 @@ You add these attributes to your code for the compiler to emit a specified Inter
16
16
|<xref:System.Runtime.CompilerServices.MethodImplAttribute?displayProperty=fullName>|`flag`| Constructor arguments specify specific named flags such as `aggressiveinlining` or `forwardref`. These flags also specify the `native`, `managed`, or `optil` modifiers for the <xref:System.Runtime.CompilerServices.MethodCodeType?displayProperty=fullName> field. |
|<xref:System.Runtime.InteropServices.StructLayoutAttribute?displayProperty=fullName>|`auto`, `sequential`, or `explicit`| Layout options can be set using the parameters. |
@@ -27,11 +26,12 @@ Some of these custom attributes are applied using other C# syntax rather than ad
|<xref:System.Runtime.InteropServices.DefaultParameterValueAttribute?displayProperty=fullName>| Specifies the default value for the parameter. Use the [default parameter syntax](../../methods.md#optional-parameters-and-arguments). |
30
-
|<xref:System.Runtime.InteropServices.InAttribute?displayProperty=fullName>| Specifies the IL `[in]` modifier. Use the [`in`](../keywords/method-parameters.md#in-parameter-modifier) or [`ref readonly`](../keywords/method-parameters.md#ref-readonly-modifier). |
29
+
|<xref:System.Runtime.InteropServices.InAttribute?displayProperty=fullName>| Specifies the IL `[in]` modifier. Use the [`in`](../keywords/method-parameters.md#in-parameter-modifier) or [`ref readonly`](../keywords/method-parameters.md#ref-readonly-modifier) modifiers. |
30
+
|<xref:System.Runtime.InteropServices.OutAttribute?displayProperty=fullName>| Specifies the IL `[out]` modifier. Use the [`out`](../keywords/method-parameters.md#out-parameter-modifier) modifier. |
31
31
|<xref:System.Runtime.CompilerServices.SpecialNameAttribute?displayProperty=fullName>| Specifies the IL `specialname` modifier. The compiler automatically adds this modifier for methods that require it. |
32
-
|<xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute?displayProperty=nameWithType>| This attribute is required for the `delegate*` feature. The compiler adds it to any [`delegate*`](../unsafe-code.md#function-pointers) that requires its use. |
32
+
|<xref:System.Runtime.InteropServices.UnmanagedCallersOnlyAttribute?displayProperty=nameWithType>| This attribute is required for the `delegate*` feature. The compiler adds it to any [`delegate*`](../unsafe-code.md#function-pointers) that requires its use. However, you must add this attribute to any method declaration when that method is assigned to a function pointer. |
33
33
34
-
The following custom attributes are generally disallowed in C# source. They're listed here to aid library authors who use reflection, and to ensure you don't create custom attributes with the same name.
34
+
The following attributes are generally disallowed in C# source. They're listed here to aid library authors who use reflection, and to ensure you don't create custom attributes with the same fully qualified name.
@@ -52,4 +52,4 @@ The following custom attributes are generally disallowed in C# source. They're l
52
52
|<xref:System.Runtime.CompilerServices.RequiredMemberAttribute?displayProperty=fullName>| This attribute indicates that the `required` modifier was placed on a member declaration. It's the encoding of the [required members](../keywords/required.md) language feature. |
53
53
|<xref:System.Runtime.CompilerServices.TupleElementNamesAttribute?displayProperty=fullName>| This attribute encodes tuple element names used in signatures. |
54
54
55
-
In addition, the compiler can generate a declaration for other attributes used internally. The compiler generates these in the <xref:System.Runtime.CompilerServices> namespace for its own use. Some aren't in the .NET Runtime libraries. Instead, the compiler synthesizes a definition for an `internal` type declaration in any assembly where the attribute is needed.
55
+
In addition, the compiler can generate a declaration for other attributes used internally. The compiler generates these attributes in the <xref:System.Runtime.CompilerServices> namespace for its own use. Some aren't in the .NET Runtime libraries. Instead, the compiler synthesizes a definition for an `internal` type declaration in any assembly where the attribute is needed.
0 commit comments