Skip to content

Commit 2cb57af

Browse files
committed
Fast follow to dotnet#44513
Address commnts on dotnet#44513 submitted after it was merged.
1 parent 00ec590 commit 2cb57af

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

docs/csharp/language-reference/attributes/pseudo-attributes.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: "Attributes interpreted by the compiler: Pseudo-attributes"
3-
ms.date: 01/2/2025
3+
ms.date: 01/28/2025
44
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."
55
---
66
# 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
1616
| <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. |
1717
| <xref:System.NonSerializedAttribute?displayProperty=fullName> | `notserialized` | |
1818
| <xref:System.Runtime.InteropServices.OptionalAttribute?displayProperty=fullName> | `[opt]` | |
19-
| <xref:System.Runtime.InteropServices.OutAttribute?displayProperty=fullName> | `[out]` | |
2019
| <xref:System.Runtime.InteropServices.PreserveSigAttribute?displayProperty=fullName> | `preservesig` | |
2120
| <xref:System.SerializableAttribute?displayProperty=fullName> | `serializable` | |
2221
| <xref:System.Runtime.InteropServices.StructLayoutAttribute?displayProperty=fullName> | `auto`, `sequential`, or `explicit` | Layout options can be set using the parameters. |
@@ -28,10 +27,11 @@ Some of these custom attributes are applied using other C# syntax rather than ad
2827
|--------------------------------------------------------------------------------------------------|----------|
2928
| <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). |
3029
| <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). |
30+
| <xref:System.Runtime.InteropServices.OutAttribute?displayProperty=fullName> | Specifies the IL`[out] modifier. Use the [`out`](../keywords/method-parameters.md#out-parameter-modifier). |
3131
| <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. |
3333

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.
3535

3636
| Attribute | Comments |
3737
|--------------------------------------------------------------------------------------------------|---------|
@@ -52,4 +52,4 @@ The following custom attributes are generally disallowed in C# source. They're l
5252
| <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. |
5353
| <xref:System.Runtime.CompilerServices.TupleElementNamesAttribute?displayProperty=fullName> | This attribute encodes tuple element names used in signatures. |
5454

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

Comments
 (0)