I tried this :

TypeReference baseCollection =
module.Import(typeof(System.Collections.ObjectModel.Collection<>));
GenericInstanceType collectionOfClass = new
GenericInstanceType(baseCollection);
collectionOfClass.GenericArguments.Add(ClassFactory.GetInterfaceDefinition(c,
_tr, module));

contains = new MethodReference("Contains",
ClassFactory.GetCollectionDefinition(c, _tr, module).BaseType,
module.Import(typeof(bool)), true, false,
MethodCallingConvention.Default);
contains.Parameters.Add(baseCollection.GenericParameters[0]);

and some others combinations, but it doesn't work. Perhaps my first
code was totally wrong for what I want? In c#, I want to do :

class MyCollectionOne:Collection<IMyInterface>   //MyCollectionOne
generated with cecil
{}

class MycollectionTwo:MyCollectionOne //MycollectionTwo generated with
cecil
{
   bool Contains(IMyInterface i)
   {
      base.Contains(i);  //that's what I want :)
   }
}
--~--~---------~--~----~------------~-------~--~----~
--
mono-cecil
-~----------~----~----~----~------~----~------~--~---

Reply via email to