Skip to content

Commit fcc52ca

Browse files
committed
edit pass
1 parent c8aad4e commit fcc52ca

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ There are several attributes that can be applied to elements in your code that a
1010
- [`Conditional`](#conditional-attribute): Make execution of a method dependent on a preprocessor identifier.
1111
- [`Obsolete`](#obsolete-and-deprecated-attribute): Mark a type or member for (potential) future removal.
1212
- [`Deprecated`](#obsolete-and-deprecated-attribute): (Windows Foundation) Mark a type or member for (potential) future removal.
13-
- [`Experimental`](#experimental-attribute): Mark a type or member as experimental.
13+
- [`Experimental`](#experimental-attributes): Mark a type or member as experimental.
1414
- [`SetsRequiredMembers`](#setsrequiredmembers-attribute): Indicate that a constructor sets all required properties.
1515
- [`AttributeUsage`](#attributeusage-attribute): Declare the language elements where an attribute can be applied.
1616
- [`AsyncMethodBuilder`](#asyncmethodbuilder-attribute): Declare an async method builder type.
@@ -72,7 +72,7 @@ The Windows Foundation Metadata libraries use the <xref:Windows.Foundation.Metad
7272
Beginning in C# 12, types, methods, and assemblies can be marked with the <xref:System.Diagnostics.CodeAnalysis.ExperimentalAttribute?displayProperty=nameWithType> to indicate an experimental feature. The compiler issues a warning if you access a method or type annotated with the <xref:System.Diagnostics.CodeAnalysis.ExperimentalAttribute>. All types declared in an assembly or module marked with the `Experimental` attribute are experimental. The compiler issues a warning if you access any of them. You can disable these warnings to pilot an experimental feature.
7373

7474
> [!WARNING]
75-
> Experimental features are subject to changes. The APIs may change, or they may be removed in future updates. Including experimental features is a way for library authors to get feedback on ideas and concepts for future development. Use extreme caution when using any feature marked as experimental.
75+
> Experimental features are subject to changes. The APIs can change, or they can be removed in future updates. Including experimental features is a way for library authors to get feedback on ideas and concepts for future development. Use extreme caution when using any feature marked as experimental.
7676
7777
You can read more details about the `Experimental` attribute in the [feature specification](~/_csharplang/proposals/csharp-12.0/experimental-attribute.md).
7878

@@ -255,11 +255,11 @@ All overloads with a lower priority than the highest overload priority are remov
255255

256256
## EnumeratorCancellation attribute
257257

258-
This attributes specifies which parameter should receive the cancellation token from <xref:System.Collections.Generic.IAsyncEnumerable%2A1.GetAsyncEnumerator(System.Threading.CancellationToken)?displayProperty=nameWithType> 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 <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.
259259

260260
## CollectionBuilder attribute
261261

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 will generate code to call that method when a collection expression is converted to that type.
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.
263263

264264
## InlineArray attribute
265265

Lines changed: 9 additions & 9 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/23/2025
3+
ms.date: 01/2/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
@@ -11,7 +11,7 @@ You add these attributes to your code for the compiler to emit specified Interme
1111
- <xref:System.Runtime.InteropServices.DllImportAttribute?displayProperty=fullName>: Specifies the `pinvokeimpl` modifier. You can add options listed in the constructor.
1212
- <xref:System.Runtime.InteropServices.FieldOffsetAttribute?displayProperty=fullName>: Specifies the `.field` offset modifier.
1313
- <xref:System.Runtime.InteropServices.MarshalAsAttribute>: Specifies the IL `marshal` modifier. You can set options listed in the constructor.
14-
- <xref:System.Runtime.CompilerServices.MethodImplAttribute?displayProperty=fullName>: maps to the IL `flag` modifier. Constructor arguments specify specific named flags such as `aggressiveinlining` or `forwardref`, as well as `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.
1515
- <xref:System.NonSerializedAttribute?displayProperty=fullName>: Specifies the IL `notserialized` modifier.
1616
- <xref:System.Runtime.InteropServices.OptionalAttribute?displayProperty=fullName>: Specifies the IL `[opt]` modifier.
1717
- <xref:System.Runtime.InteropServices.OutAttribute?displayProperty=fullName>: Specifies the IL `[out]` modifier.
@@ -20,30 +20,30 @@ You add these attributes to your code for the compiler to emit specified Interme
2020
- <xref:System.Runtime.InteropServices.StructLayoutAttribute?displayProperty=fullName>: Specifies the IL `auto`, `sequential`, or `explicit` modifiers. Layout options can be set using the parameters.
2121
- <xref:System.Runtime.CompilerServices.IndexerNameAttribute?displayProperty=fullName>: You 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.
2222

23-
Some of these custom attributes are generally applied using other C# syntax rather than adding the attribute to your source code.
23+
Some of these custom attributes are applied using other C# syntax rather than adding the attribute to your source code.
2424

2525
- <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)
2626
- <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).
2727
- <xref:System.Runtime.CompilerServices.SpecialNameAttribute?displayProperty=fullName>: Specifies the IL `specialname` modifier. The compiler automatically uses the for methods that require the `specialname` modifier.
2828
- <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.
2929

30-
The following custom attributes are generally disallowed in C# source. They are listed here to aid library authors who use reflection, and to ensure you don't create custom attributes with the same name.
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.
3131

3232
- <xref:System.Runtime.CompilerServices.CompilerFeatureRequiredAttribute?displayProperty=fullName>: Prevents downlevel compilers from using metadata it can't safely understand.
3333
- <xref:System.Runtime.CompilerServices.DecimalConstantAttribute?displayProperty=fullName>: Encodes `const decimal` fields. The runtime doesn't support `decimal` values as constant values.
34-
- <xref:System.Reflection.DefaultMemberAttribute?displayProperty=fullName>: Encodes indexers with [IndexerNameAttribute](https://learn.microsoft.com/en-us/dotnet/api/system.runtime.compilerservices.indexernameattribute). This attributes notes the default indexer when its name has been customized. This attribute is allowed in source.
34+
- <xref:System.Reflection.DefaultMemberAttribute?displayProperty=fullName>: Encodes indexers with <xref:System.Runtime.CompilerServices.IndexerNameAttribute?displayProperty=fullName>. This attribute notes the default indexer when its name is different than `Item`. This attribute is allowed in source.
3535
- <xref:System.Runtime.CompilerServices.DynamicAttribute?displayProperty=fullName>: Encodes whether a type in a signature is `dynamic` (versus `object`).
36-
- <xref:System.Runtime.CompilerServices.ExtensionAttribute?displayProperty=fullName>: This attributes notes extension methods. The compiler also places this attribute on the containing classes.
36+
- <xref:System.Runtime.CompilerServices.ExtensionAttribute?displayProperty=fullName>: This attribute notes extension methods. The compiler also places this attribute on the containing classes.
3737
- <xref:System.Runtime.CompilerServices.FixedBufferAttribute?displayProperty=fullName>: This attribute specifies `fixed` struct fields.
3838
- <xref:System.Runtime.CompilerServices.IsByRefLikeAttribute?displayProperty=fullName>: This attribute specifies a `ref` struct.
3939
- <xref:System.Runtime.CompilerServices.IsReadOnlyAttribute?displayProperty=fullName>: This attribute indicates that a parameter has the `in` modifier. It distinguishes `in` parameters from `readonly ref` or `[In] ref`.
40-
- <xref:System.Runtime.CompilerServices.RequiresLocationAttribute?displayProperty=fullName>: This attributes indicates that a parameter has the `readonly ref` modifier. Ut distinguishes `readonly ref` from `in` or `[In] ref`.
40+
- <xref:System.Runtime.CompilerServices.RequiresLocationAttribute?displayProperty=fullName>: This attribute indicates that a parameter has the `readonly ref` modifier. It distinguishes `readonly ref` from `in` or `[In] ref`.
4141
- <xref:System.Runtime.CompilerServices.IsUnmanagedAttribute?displayProperty=fullName> - This attribute specifies the `unmanaged` constraint on a type parameter.
4242
- <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.
4343
- <xref:System.ParamArrayAttribute?displayProperty=fullName>: This attribute encodes the `params` modifier on array parameters.
4444
- <xref:System.Runtime.CompilerServices.ParamCollectionAttribute?displayProperty=fullName> This attribute encodes the `params` on non-array parameters.
45-
- <xref:System.Runtime.CompilerServices.RefSafetyRulesAttribute?displayProperty=fullName>: This attributes specifies the C# version that is required in order to understand ref safety annotations in the assembly. Ref safety rules have evolved as new features have been added to the language.
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.
4646
- <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.
4747
- <xref:System.Runtime.CompilerServices.TupleElementNamesAttribute?displayProperty=fullName>: This attribute encodes tuple element names used in signatures.
4848

49-
In addition, the compiler may generate a declaration for other attributes used internally. For this reason, you should assume other attributes in the <xref:System.Runtime.CompilerServices> namespace. Some aren't in the .NET Runtime, but are generated by the compiler as an `internal` type declaration in any assembly where the attribute is needed.
49+
In addition, the compiler can generate a declaration for other attributes used internally. For this reason, you should assume other attributes in the <xref:System.Runtime.CompilerServices> namespace. Some aren't in the .NET Runtime. Instead, the compiler synthesizes a definition for an `internal` type declaration in any assembly where the attribute is needed.

0 commit comments

Comments
 (0)