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/general.md
+2-2Lines changed: 2 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -255,11 +255,11 @@ All overloads with a lower priority than the highest overload priority are remov
255
255
256
256
## EnumeratorCancellation attribute
257
257
258
-
The <xref:System.Runtime.CompilerServices.EnumeratorCancellationAttribute?displayProperty=nameWithType> attribute specifies which parameter should receive the cancellation token from <xref:System.Collections.Generic.IAsyncEnumerable`1.GetAsyncEnumerator(System.Threading.CancellationToken)?displayProperty=fullName> API. It's part of the infrastructure for the [async streams](../../asynchronous-programming/generate-consume-asynchronous-stream.md) feature.
258
+
The <xref:System.Runtime.CompilerServices.EnumeratorCancellationAttribute?displayProperty=nameWithType> attribute specifies which parameter should receive the cancellation token from the <xref:System.Collections.Generic.IAsyncEnumerable`1.GetAsyncEnumerator(System.Threading.CancellationToken)?displayProperty=fullName> API. It's part of the infrastructure for the [async streams](../../asynchronous-programming/generate-consume-asynchronous-stream.md) feature.
259
259
260
260
## CollectionBuilder attribute
261
261
262
-
The <xref:System.Runtime.CompilerServices.CollectionBuilderAttribute?displayProperty=nameWithType> specifies a method that builds an instance of a collection type from a [collection expression](../operators/collection-expressions.md). You use this attribute to specify a method that builds the collection. The compiler generates code to call that method when a collection expression is converted to that type.
262
+
The <xref:System.Runtime.CompilerServices.CollectionBuilderAttribute?displayProperty=nameWithType>attribute specifies a method that builds an instance of a collection type from a [collection expression](../operators/collection-expressions.md). You use this attribute to specify a method that builds the collection. The compiler generates code to call that method when a collection expression is converted to that type.
Copy file name to clipboardExpand all lines: docs/csharp/language-reference/attributes/pseudo-attributes.md
+5-5Lines changed: 5 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,13 +5,13 @@ description: "Learn about attributes you can add to code that are written to IL
5
5
---
6
6
# Custom attributes that generate flags or options in the Intermediate Language (IL) output
7
7
8
-
You add these attributes to your code for the compiler to emit specified Intermediate Language (IL) modifier. These attributes instruct the compiler to include the corresponding IL modifier in the output. These IL modifiers can be controlled in C# using these attributes:
8
+
You add these attributes to your code for the compiler to emit a specified Intermediate Language (IL) modifier. These attributes instruct the compiler to include the corresponding IL modifier in the output.
9
9
10
10
-<xref:System.Runtime.InteropServices.ComImportAttribute?displayProperty=fullName>: Specifies the `import` modifier.
11
11
-<xref:System.Runtime.InteropServices.DllImportAttribute?displayProperty=fullName>: Specifies the `pinvokeimpl` modifier. You can add options listed in the constructor.
12
12
-<xref:System.Runtime.InteropServices.FieldOffsetAttribute?displayProperty=fullName>: Specifies the `.field` offset modifier.
13
13
-<xref:System.Runtime.InteropServices.MarshalAsAttribute>: Specifies the IL `marshal` modifier. You can set options listed in the constructor.
14
-
4- <xref:System.Runtime.CompilerServices.MethodImplAttribute?displayProperty=fullName>: maps to the IL `flag` modifier. 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.
14
+
4- <xref:System.Runtime.CompilerServices.MethodImplAttribute?displayProperty=fullName>: Maps to the IL `flag` modifier. 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.
15
15
-<xref:System.NonSerializedAttribute?displayProperty=fullName>: Specifies the IL `notserialized` modifier.
16
16
-<xref:System.Runtime.InteropServices.OptionalAttribute?displayProperty=fullName>: Specifies the IL `[opt]` modifier.
17
17
-<xref:System.Runtime.InteropServices.OutAttribute?displayProperty=fullName>: Specifies the IL `[out]` modifier.
@@ -22,10 +22,10 @@ You add these attributes to your code for the compiler to emit specified Interme
22
22
23
23
Some of these custom attributes are applied using other C# syntax rather than adding the attribute to your source code.
24
24
25
-
-<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)
25
+
-<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).
26
26
-<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).
27
27
-<xref:System.Runtime.CompilerServices.SpecialNameAttribute?displayProperty=fullName>: Specifies the IL `specialname` modifier. The compiler automatically uses the for methods that require the `specialname` modifier.
28
-
-<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) requires its use.
28
+
-<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.
29
29
30
30
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.
31
31
@@ -41,7 +41,7 @@ The following custom attributes are generally disallowed in C# source. They're l
41
41
-<xref:System.Runtime.CompilerServices.IsUnmanagedAttribute?displayProperty=fullName> - This attribute specifies the `unmanaged` constraint on a type parameter.
42
42
-<xref:System.Runtime.CompilerServices.NullableAttribute?displayProperty=fullName>, <xref:System.Runtime.CompilerServices.NullableContextAttribute?displayProperty=fullName>, <xref:System.Runtime.CompilerServices.NullablePublicOnlyAttribute?displayProperty=fullName>: These attributes encode nullable annotations in your source code.
43
43
-<xref:System.ParamArrayAttribute?displayProperty=fullName>: This attribute encodes the `params` modifier on array parameters.
44
-
-<xref:System.Runtime.CompilerServices.ParamCollectionAttribute?displayProperty=fullName> This attribute encodes the `params` on non-array parameters.
44
+
-<xref:System.Runtime.CompilerServices.ParamCollectionAttribute?displayProperty=fullName> This attribute encodes the `params`modifier on non-array parameters.
45
45
-<xref:System.Runtime.CompilerServices.RefSafetyRulesAttribute?displayProperty=fullName>: This attribute specifies the C# version that is required in order to understand ref safety annotations in the assembly. Ref safety rules evolve as C# gets new features.
46
46
-<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.
47
47
-<xref:System.Runtime.CompilerServices.TupleElementNamesAttribute?displayProperty=fullName>: This attribute encodes tuple element names used in signatures.
0 commit comments