Generic function return List C# -
i new in c# , reading generics functions. can*t understand wrong? have, example, function:
public list<t> cuttext (list<t> list) { foreach (var in list) { a.text = "yes"; } return list; }
your function not generic. invalid non-compilable function returns list of unknown type t. either function or class should have
<t>in declaration in order make generic.for example, this:
public list<t> cuttext<t>(list<t> list) { foreach (var in list) { a.text = "yes"; } return list; }even if mark generic, type t not have
textproperty untiltspecified more precisely class or interface havingtextproperty:public list<t> cuttext<t>(list<t> list) t : textboxor
public list<t> cuttext<t>(list<t> list) t : ianyinterfacehavingtextproperty
Comments
Post a Comment