list - C# Cannot convert lambda expression to type 'dynamic' because it is not a delegate type -


suppose have

list<dynamic> mylist = new list<dynamic>(); 

inside class:

public class dynamicmixin : dynamicobject {     internal list<dynamic> mylist= new list<dynamic>();      public void addinterface<t>(t _item) t:class{         interfaces.add(_item);     }      public override bool trygetindex(getindexbinder binder, object[] indexes, out object result)     {         if (mylist.contains((item)=>item.gettype().equals(indexes[0].gettype())){             /* */         }         return base.trygetindex(binder, indexes, out result);     }  } 

i'm trying write mydynamicobject[typeof(idisposable)] idiposable object belongs mydynamicobject.

this line gives me error:

if (mylist.contains((item)=>item.gettype().equals(indexes[0].gettype())){ 

cannot convert lambda expression type 'dynamic' because not delegate type

i'm able iterating through list: why i'm not capable of using contains ?

becasue conaints declared as:

public bool contains(     t item ) 

you shoud use any(your lambda)


Comments