Skip to content

Commit

Permalink
Explain better conversion from collection expression (dotnet#42995)
Browse files Browse the repository at this point in the history
* Explain better conversion from collection expression

Fixes dotnet#42819

* fix warnings from C# standard update

We merged part of NRT into the C# standard repo. Fix the ripple effects of renumbering sections.
  • Loading branch information
BillWagner authored Oct 9, 2024
1 parent 8a67306 commit 2d97105
Show file tree
Hide file tree
Showing 8 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -277,7 +277,7 @@ You can use the `checked` modifier only when you overload any of the following o

For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md):

- [Postfix increment and decrement operators](~/_csharpstandard/standard/expressions.md#12815-postfix-increment-and-decrement-operators)
- [Postfix increment and decrement operators](~/_csharpstandard/standard/expressions.md#12816-postfix-increment-and-decrement-operators)
- [Prefix increment and decrement operators](~/_csharpstandard/standard/expressions.md#1296-prefix-increment-and-decrement-operators)
- [Unary plus operator](~/_csharpstandard/standard/expressions.md#1292-unary-plus-operator)
- [Unary minus operator](~/_csharpstandard/standard/expressions.md#1293-unary-minus-operator)
Expand All @@ -287,7 +287,7 @@ For more information, see the following sections of the [C# language specificati
- [Addition operator](~/_csharpstandard/standard/expressions.md#12105-addition-operator)
- [Subtraction operator](~/_csharpstandard/standard/expressions.md#12106-subtraction-operator)
- [Compound assignment](~/_csharpstandard/standard/expressions.md#12214-compound-assignment)
- [The checked and unchecked operators](~/_csharpstandard/standard/expressions.md#12819-the-checked-and-unchecked-operators)
- [The checked and unchecked operators](~/_csharpstandard/standard/expressions.md#12820-the-checked-and-unchecked-operators)
- [Numeric promotions](~/_csharpstandard/standard/expressions.md#1247-numeric-promotions)

## See also
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ The compiler uses static analysis to determine the most performant way to create

Many APIs are overloaded with multiple collection types as parameters. Because a collection expression can be converted to many different expression types, these APIs might require casts on the collection expression to specify the correct conversion. The following conversion rules resolve some of the ambiguities:

- A better element conversion is preferred over a better collection type conversion. In other words, the type of elements in the collection expression has more importance than the type of the collection. These rules are described in the feature spec for [better conversion from collection expression](~/_csharplang/proposals/csharp-13.0/collection-expressions-better-conversion.md).
- Conversion to <xref:System.Span%601>, <xref:System.ReadOnlySpan%601>, or another [`ref struct`](../builtin-types/ref-struct.md) type is better than a conversion to a non-ref struct type.
- Conversion to a noninterface type is better than a conversion to an interface type.

Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/operators/default.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ The following example shows the usage of the `default` literal:
## C# language specification

For more information, see the [Default value expressions](~/_csharpstandard/standard/expressions.md#12820-default-value-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md).
For more information, see the [Default value expressions](~/_csharpstandard/standard/expressions.md#12821-default-value-expressions) section of the [C# language specification](~/_csharpstandard/standard/README.md).

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -250,9 +250,9 @@ The `.`, `()`, `^`, and `..` operators can't be overloaded. The `[]` operator is
For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md):

- [Member access](~/_csharpstandard/standard/expressions.md#1287-member-access)
- [Element access](~/_csharpstandard/standard/expressions.md#12811-element-access)
- [Element access](~/_csharpstandard/standard/expressions.md#12812-element-access)
- [Null-conditional member access](~/_csharpstandard/standard/expressions.md#1288-null-conditional-member-access)
- [Invocation expressions](~/_csharpstandard/standard/expressions.md#1289-invocation-expressions)
- [Invocation expressions](~/_csharpstandard/standard/expressions.md#12810-invocation-expressions)

For more information about indices and ranges, see the [feature proposal note](~/_csharplang/proposals/csharp-8.0/ranges.md).

Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/operators/nameof.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ When the operand is a [verbatim identifier](../tokens/verbatim.md), the `@` char

## C# language specification

For more information, see the [Nameof expressions](~/_csharpstandard/standard/expressions.md#12822-the-nameof-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md), and the [C# 11 - Extended `nameof` scope](~/_csharplang/proposals/csharp-11.0/extended-nameof-scope.md) feature specification.
For more information, see the [Nameof expressions](~/_csharpstandard/standard/expressions.md#12823-the-nameof-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md), and the [C# 11 - Extended `nameof` scope](~/_csharplang/proposals/csharp-11.0/extended-nameof-scope.md) feature specification.

## See also

Expand Down
2 changes: 1 addition & 1 deletion docs/csharp/language-reference/operators/new-operator.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ A user-defined type can't overload the `new` operator.

## C# language specification

For more information, see [The new operator](~/_csharpstandard/standard/expressions.md#12816-the-new-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md).
For more information, see [The new operator](~/_csharpstandard/standard/expressions.md#12817-the-new-operator) section of the [C# language specification](~/_csharpstandard/standard/README.md).

For more information about a target-typed `new` expression, see the [feature proposal note](~/_csharplang/proposals/csharp-9.0/target-typed-new.md).

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ For more information, see the following sections of the [C# language specificati
- [The is operator](~/_csharpstandard/standard/expressions.md#121212-the-is-operator)
- [The as operator](~/_csharpstandard/standard/expressions.md#121213-the-as-operator)
- [Cast expressions](~/_csharpstandard/standard/expressions.md#1297-cast-expressions)
- [The typeof operator](~/_csharpstandard/standard/expressions.md#12817-the-typeof-operator)
- [The typeof operator](~/_csharpstandard/standard/expressions.md#12818-the-typeof-operator)

## See also

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ Constant expressions are evaluated by default in a checked context and a compile
For more information, see the following sections of the [C# language specification](~/_csharpstandard/standard/README.md):

- [The checked and unchecked statements](~/_csharpstandard/standard/statements.md#1312-the-checked-and-unchecked-statements)
- [The checked and unchecked operators](~/_csharpstandard/standard/expressions.md#12819-the-checked-and-unchecked-operators)
- [The checked and unchecked operators](~/_csharpstandard/standard/expressions.md#12820-the-checked-and-unchecked-operators)
- [User-defined checked and unchecked operators - C# 11](~/_csharplang/proposals/csharp-11.0/checked-user-defined-operators.md)

## See also
Expand Down

0 comments on commit 2d97105

Please sign in to comment.