C# Generic conditional where clause -
this question has answer here:
- conditional either-or on type constraint 2 answers
i know if possible introduce conditional within clause. example if have 2 generics:
public static y convert<t, y>(t itemtoconvert) t : idatatypeconverter, new() y : idatatypeconverter2, new() { } public static y convert2<t, y>(t itemtoconvert) t : idatatypeconverter2, new() y : idatatypeconverter, new() { }
how join them one?
thanks!
make both data type converters inherit same interface. use interface in clause.
Comments
Post a Comment