An open API service indexing awesome lists of open source software.

https://github.com/kolosovpetro/covariantfactory

Simple snippet to show the use of covariance in C#.
https://github.com/kolosovpetro/covariantfactory

covariance csharp

Last synced: 8 months ago
JSON representation

Simple snippet to show the use of covariance in C#.

Awesome Lists containing this project

README

          

# Covariant Factory

Simple snippet to show the use of covariance in C#.

## Example

```cs
ICovariantFactory dogFactory = new CovariantFactory();
var dog = dogFactory.CreateInstance("Sharik", 2);
dog.SayName();
dog.SayAge();

ICovariantFactory wolfFactory = new CovariantFactory();
var wolf = wolfFactory.CreateInstance("Bamboo", 5);
wolf.SayName();
wolf.SayAge();
```