Collection expressions: include additional implicit conversions (#7533)
This commit is contained in:
Родитель
d377cf3407
Коммит
00693edc5d
|
@ -132,8 +132,6 @@ The following implicit *collection expression conversions* exist from a collecti
|
|||
|
||||
* For each *element* `Ei` there is an *implicit conversion* to `T`.
|
||||
|
||||
* To a *nullable value type* `T?` where there is *collection expression conversion* from the collection expression to `T`.
|
||||
|
||||
In the cases above, a collection literal *element* `Ei` is considered to have an *implicit conversion* to *type* `T` if:
|
||||
|
||||
* `Ei` is an *expression element* and there is an implicit conversion from `Ei` to `T`.
|
||||
|
@ -141,6 +139,14 @@ In the cases above, a collection literal *element* `Ei` is considered to have an
|
|||
|
||||
Types for which there is an implicit collection expression conversion from a collection literal are the valid *target types* for that collection literal.
|
||||
|
||||
The following additional implicit conversions exist from a *collection expression*:
|
||||
|
||||
* To a *nullable value type* `T?` where there is a *collection expression conversion* from the collection expression to a value type `T`. The conversion is a *collection expression conversion* to `T` followed by an *implicit nullable conversion* from `T` to `T?`.
|
||||
|
||||
* To a reference type `T` where there is a *[create method](#create-methods)* associated with `T` that returns a type `U` and an *implicit reference conversion* from `U` to `T`. The conversion is a *collection expression conversion* to `U` followed by an *implicit reference conversion* from `U` to `T`.
|
||||
|
||||
* To an interface type `I` where there is a *[create method](#create-methods)* associated with `I` that returns a type `V` and an *implicit boxing conversion* from `V` to `I`. The conversion is a *collection expression conversion* to `V` followed by an *implicit boxing conversion* from `V` to `I`.
|
||||
|
||||
## Create methods
|
||||
[create-methods]: #create-methods
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче