Is C# 4.0 Tuple covariant
Is C# 4.0 Tuple covariantCo/Contravariance? Tuple<string, IEnumerable<string>> not satisfied with List<string>
Co/Contravariance? Tuple<string, IEnumerable> not satisfied with List
So I decide to make my own implementation of an interface which subclass a tuple with a support for Covariance:
First problem : subclass and equality support Problems:
- Subclass and equality support
Second problem : naming convention
- Naming convention
Is C# 4.0 Tuple covariant
Co/Contravariance? Tuple<string, IEnumerable<string>> not satisfied with List<string>
So I decide to make my own implementation of an interface which subclass a tuple with a support for Covariance:
First problem : subclass and equality support
Second problem : naming convention
I decide to make my own implementation of an interface which subclass a tuple with a support for Covariance:
Problems:
- Subclass and equality support
- Naming convention
First problem : subclass and equality support
Subclassing the tuple is easy and there is nothing to do, and this is my concern. Is there something am I missing? I see no reason why equalities and hashcode souldn't work as expected with classic Tuple, but maybe you will find a problem somewhere which I didn't think of.
Second problem : naming convention
- Like the static class
Tuple
contains all theCreate
static methods,ITuple
, which is not an interface, has the static builder. At what point is this weird to name a non interface with anI
prefix? - At first, I called the
ITuple
interfaceICovariantTuple
, but found it too long, and there is noITuple
in the framework. Is this evident thatITuple
is covariant?
Subclassing the tuple is easy and there is nothing to do, and this is my concern. Is there something am I missing? I see no reason why equalities and hashcode souldn't work as expected with classic Tuple, but maybe you will find a problem somewhere which I didn't think of.
First problem : subclass and equality support
Subclassing the tuple is easy and there is nothing to do, and this is my concern. Is there something am I missing? I see no reason why equalities and hashcode souldn't work as expected with classic Tuple, but maybe you will find a problem somewhere which I didn't think of.
Second problem : naming convention
- Like the static class
Tuple
contains all theCreate
static methods,ITuple
, which is not an interface, has the static builder. At what point is this weird to name a non interface with anI
prefix? - At first, I called the
ITuple
interfaceICovariantTuple
, but found it too long, and there is noITuple
in the framework. Is this evident thatITuple
is covariant?