From 2cb57afd160b583442f109ee9bcaafdcc4d10c36 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 28 Jan 2025 08:37:36 -0500 Subject: [PATCH 1/2] Fast follow to #44513 Address commnts on #44513 submitted after it was merged. --- .../language-reference/attributes/pseudo-attributes.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/docs/csharp/language-reference/attributes/pseudo-attributes.md b/docs/csharp/language-reference/attributes/pseudo-attributes.md index 6634c52d8f1b5..c3ed5e85733e8 100644 --- a/docs/csharp/language-reference/attributes/pseudo-attributes.md +++ b/docs/csharp/language-reference/attributes/pseudo-attributes.md @@ -1,6 +1,6 @@ --- title: "Attributes interpreted by the compiler: Pseudo-attributes" -ms.date: 01/2/2025 +ms.date: 01/28/2025 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." --- # 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 | | `flag` | Constructor arguments specify specific named flags such as `aggressiveinlining` or `forwardref`. These flags also specify the `native`, `managed`, or `optil` modifiers for the field. | | | `notserialized` | | | | `[opt]` | | -| | `[out]` | | | | `preservesig` | | | | `serializable` | | | | `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 |--------------------------------------------------------------------------------------------------|----------| | | Specifies the default value for the parameter. Use the [default parameter syntax](../../methods.md#optional-parameters-and-arguments). | | | 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). | +| | Specifies the IL`[out] modifier. Use the [`out`](../keywords/method-parameters.md#out-parameter-modifier). | | | Specifies the IL `specialname` modifier. The compiler automatically adds this modifier for methods that require it. | -| | This attribute is required for the `delegate*` feature. The compiler adds it to any [`delegate*`](../unsafe-code.md#function-pointers) that requires its use. | +| | 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. | -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. +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. | Attribute | Comments | |--------------------------------------------------------------------------------------------------|---------| @@ -52,4 +52,4 @@ The following custom attributes are generally disallowed in C# source. They're l | | 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. | | | This attribute encodes tuple element names used in signatures. | -In addition, the compiler can generate a declaration for other attributes used internally. The compiler generates these in the 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. +In addition, the compiler can generate a declaration for other attributes used internally. The compiler generates these attributes in the 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. From 89c872d94ce9124c260e67d6f782aa278b3da1d6 Mon Sep 17 00:00:00 2001 From: Bill Wagner Date: Tue, 28 Jan 2025 17:48:23 -0500 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Genevieve Warren <24882762+gewarren@users.noreply.github.com> --- .../csharp/language-reference/attributes/pseudo-attributes.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/csharp/language-reference/attributes/pseudo-attributes.md b/docs/csharp/language-reference/attributes/pseudo-attributes.md index c3ed5e85733e8..ff9d7b692cb96 100644 --- a/docs/csharp/language-reference/attributes/pseudo-attributes.md +++ b/docs/csharp/language-reference/attributes/pseudo-attributes.md @@ -26,8 +26,8 @@ Some of these custom attributes are applied using other C# syntax rather than ad | Attribute | Comments | |--------------------------------------------------------------------------------------------------|----------| | | Specifies the default value for the parameter. Use the [default parameter syntax](../../methods.md#optional-parameters-and-arguments). | -| | 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). | -| | Specifies the IL`[out] modifier. Use the [`out`](../keywords/method-parameters.md#out-parameter-modifier). | +| | 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. | +| | Specifies the IL `[out]` modifier. Use the [`out`](../keywords/method-parameters.md#out-parameter-modifier) modifier. | | | Specifies the IL `specialname` modifier. The compiler automatically adds this modifier for methods that require it. | | | 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. |