@@ -460,7 +460,7 @@ The explicit enumeration conversions are:
460
460
461
461
An explicit enumeration conversion between two types is processed by treating any participating *enum_type * as the underlying type of that *enum_type *, and then performing an implicit or explicit numeric conversion between the resulting types .
462
462
463
- > * Example * : Given an * enum_type * `E ` with and underlying type of `int `, a conversion from `E ` to `byte ` is processed as an explicit numeric conversion ([§10.3.2 ](conversions .md #1032-explicit -numeric -conversions )) from `int ` to `byte `, and a conversion from `byte ` to `E ` is processed as an implicit numeric conversion ([§10.2.3 ](conversions .md #1023-implicit -numeric -conversions )) from `byte ` to `int `. * end example *
463
+ > * Example * : Given an * enum_type * `E ` with an underlying type of `int `, a conversion from `E ` to `byte ` is processed as an explicit numeric conversion ([§10.3.2 ](conversions .md #1032-explicit -numeric -conversions )) from `int ` to `byte `, and a conversion from `byte ` to `E ` is processed as an implicit numeric conversion ([§10.2.3 ](conversions .md #1023-implicit -numeric -conversions )) from `byte ` to `int `. * end example *
464
464
465
465
### 10.3.4 Explicit nullable conversions
466
466
@@ -509,7 +509,7 @@ An unboxing conversion permits a *reference_type* to be explicitly converted to
509
509
- From the type `System .Enum ` to any * enum_type * .
510
510
- From any * interface_type * to any * non_nullable_value_type * that implements the * interface_type * .
511
511
- From any * interface_type * `I ` to any * non_nullable_value_type * where there is an unboxing conversion from an *interface_type * `I ₀` to the *non_nullable_value -type * and an identity conversion from `I ` to `I ₀`.
512
- - From any *interface_type * `I ` to any *non_nullable_value_type * where there is an unboxing conversion from an *interface_type * `I ₀` to the *non_nullable_value_type * and either either `I ₀` is variance_convertible to `I ` or `I ` is variance -convertible to `I ₀` ([§18.2.3.3 ](interfaces .md #18233-variance -conversion )).
512
+ - From any *interface_type * `I ` to any *non_nullable_value_type * where there is an unboxing conversion from an *interface_type * `I ₀` to the *non_nullable_value_type * and either `I ₀` is variance_convertible to `I ` or `I ` is variance -convertible to `I ₀` ([§18.2.3.3 ](interfaces .md #18233-variance -conversion )).
513
513
- From any * reference_type * to any * nullable_value_type * where there is an unboxing conversion from *reference_type * to the underlying *non_nullable_value_type * of the *nullable_value_type *.
514
514
- From a type parameter which is not known to be a value type to any type such that the conversion is permitted by [§10.3.8](conversions .md #1038 - explicit - conversions - involving - type - parameters ).
515
515
@@ -661,8 +661,8 @@ Once a most-specific user-defined conversion operator has been identified, the a
661
661
Evaluation of a user - defined conversion never involves more than one user - defined or lifted conversion operator . In other words , a conversion from type `S ` to type `T ` will never first execute a user - defined conversion from `S ` to `X ` and then execute a user - defined conversion from `X ` to `T `.
662
662
663
663
- Exact definitions of evaluation of user - defined implicit or explicit conversions are given in the following subclauses . The definitions make use of the following terms :
664
- - If a standard implicit conversion ([§10.4.2 ](conversions .md #1042 - standard - implicit - conversions )) exists from a type `A ` to a type `B `, and if neither `A ` nor `B ` are * interface_type * `s `, then `A ` is said to be ***encompassed by *** `B `, and `B ` is said to ***encompass *** `A `.
665
- - If a standard implicit conversion ([§10.4.2 ](conversions .md #1042-standard -implicit -conversions )) exists from an expression `E ` to a type `B `, and if neither `B ` nor the type of `E ` (if it has one ) are * interface_type * `s `, then `E ` is said to be *encompassed by * `B `, and `B ` is said to *encompass * `E `.
664
+ - If a standard implicit conversion ([§10.4.2 ](conversions .md #1042 - standard - implicit - conversions )) exists from a type `A ` to a type `B `, and if neither `A ` nor `B ` are * interface_type * `S `, then `A ` is said to be ***encompassed by *** `B `, and `B ` is said to ***encompass *** `A `.
665
+ - If a standard implicit conversion ([§10.4.2 ](conversions .md #1042-standard -implicit -conversions )) exists from an expression `E ` to a type `B `, and if neither `B ` nor the type of `E ` (if it has one ) are * interface_type * `S `, then `E ` is said to be *encompassed by * `B `, and `B ` is said to *encompass * `E `.
666
666
- The ***most -encompassing type *** in a set of types is the one type that encompasses all other types in the set . If no single type encompasses all other types , then the set has no most - encompassing type . In more intuitive terms , the most - encompassing type is the “largest ” type in the set —the one type to which each of the other types can be implicitly converted .
667
667
- The ***most -encompassed type *** in a set of types is the one type that is encompassed by all other types in the set . If no single type is encompassed by all other types , then the set has no most - encompassed type . In more intuitive terms , the most - encompassed type is the “smallest ” type in the set —the one type that can be implicitly converted to each of the other types .
668
668
@@ -701,7 +701,7 @@ A user-defined explicit conversion from an expression `E` to a type `T` is pro
701
701
- If `E ` has a type , let `S ` be that type .
702
702
- If `S ` or `T ` are nullable value types , let `S ᵢ` and `T ᵢ` be their underlying types , otherwise let `S ᵢ` and `T ᵢ` be `S ` and `T `, respectively .
703
703
- If `S ᵢ` or `T ᵢ` are type parameters , let `S ₀` and `T ₀` be their effective base classes , otherwise let `S ₀` and `T ₀` be `S ᵢ` and `T ᵢ`, respectively .
704
- - Find the set of types , `D `, from which user - defined conversion operators will be considered . This set consists of `S ₀` (if `S ₀` exists and is a class or struct ), the base classes of `S ₀` (if `S ₀` exists and is a class ), `T ₀` (if `T ₀` is a class or struct ), and the base classes of `T ₀` (if `T ₀` is a class ). ` A ` type is added to the set `D ` only if an identity conversion to another type already included in the set doesn ’t exist .
704
+ - Find the set of types , `D `, from which user - defined conversion operators will be considered . This set consists of `S ₀` (if `S ₀` exists and is a class or struct ), the base classes of `S ₀` (if `S ₀` exists and is a class ), `T ₀` (if `T ₀` is a class or struct ), and the base classes of `T ₀` (if `T ₀` is a class ). A type is added to the set `D ` only if an identity conversion to another type already included in the set doesn ’t exist .
705
705
- Find the set of applicable user -defined and lifted conversion operators , `U `. This set consists of the user - defined and lifted implicit or explicit conversion operators declared by the classes or structs in `D ` that convert from a type encompassing `E ` or encompassed by `S ` (if it exists ) to a type encompassing or encompassed by `T `. If `U ` is empty , the conversion is undefined and a compile -time error occurs .
706
706
- Find the most -specific source type , `S ₓ`, of the operators in `U `:
707
707
- If S exists and any of the operators in `U ` convert from `S `, then `S ₓ` is `S `.
0 commit comments