mirror of
https://github.com/m-lamonaca/dev-notes.git
synced 2025-04-06 10:56:41 +00:00
Add variance summary image
This commit is contained in:
parent
ea59857f4b
commit
0fd87958af
2 changed files with 2 additions and 0 deletions
BIN
.images/dotnet_covariant_contravariant.png
Normal file
BIN
.images/dotnet_covariant_contravariant.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 17 KiB |
|
@ -2032,6 +2032,8 @@ Generic type parameters support covariance and contravariance to provide greater
|
|||
- **Contravariance**: Enables to use a more generic (less derived) type than originally specified.
|
||||
- **Invariance**: it's possible to use _only_ the type originally specified; so an invariant generic type parameter is neither covariant nor contravariant.
|
||||
|
||||

|
||||
|
||||
**NOTE**: annotate generic type parameters with `out` and `in` annotations to specify whether they should behave covariantly or contravariantly.
|
||||
|
||||
```cs
|
||||
|
|
Loading…
Add table
Reference in a new issue