Basically, I want to write a wrapper for all ICollection<> types. Lets call it DelayedAddCollection. It should take any ICollection as its .
Furthermore, I need access to that ICollection type's generic type as the Add method needs to restrict its parameter to that type.
The syntax I would imagine would look something like this...
public DelayedAddConnection<T>: where T:ICollection<U> {
....
public void Add(U element){
...
}
}
What is the real correct syntax to do this?
You need to add another generic type parameter:
public class DelayedAddConnection<T, U> where T : ICollection<U>
{
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With