Hello,
I want to retrieve a MethodReference on the Contains method from
System.Collections.ObjectModel.Collection<an interface wich I have
created>, in order to call it from a derived class of this collection
(in a new Contains method).
I tried this two solutions :
GenericInstanceType collectionOfClass = new
GenericInstanceType(module.Import(typeof(System.Collections.ObjectModel.Collection<>)));
collectionOfClass.GenericArguments.Add(ClassFactory.GetInterfaceDefinition(c,
_tr, module));
--------
contains = new MethodReference("Contains", collectionOfClass,
module.Import(typeof(bool)), true, false,
MethodCallingConvention.Default);
contains.Parameters.Add(new
ParameterDefinition(ClassFactory.GetInterfaceDefinition(c, _tr,
module)));
--------
contains =
module.Import(typeof(System.Collections.ObjectModel.Collection<>).GetMethod("Contains"));
contains.DeclaringType = collectionOfClass;
--------
but I didn't succeed. Please, can you tell me how to achieve that?
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---