Pass Interface to a generic attribute of a class in C#? -
when this:
public class ball { iteste<iitem> teste{ get; set; } }
i got error:
'iitem' must non-abstract type public parameterless constructor in order use parameter 't' in generic type or method
iteste:
public interface iteste<t> t : iitem, iequatable<t>, new() { //iteste code }
iitem:
public interface iitem : iequatable<iitem> { //iitem code }
it seems simple question, not find answer. appreciated.
remove new() constraints iteste
iteste:
public interface iteste<t>where t : iitem, iequatable<t> { //iteste code }
Comments
Post a Comment