[Mono-list] Help in customization of MCS
Miguel de Icaza
miguel at ximian.com
Thu Sep 8 15:39:47 EDT 2005
Hello,
> In my code I created a class named "aspect” that is
> derived from “Class”. So when the method “public
> override bool DefineMembers(TypeContainer parent)” is
> called by MCS I start to look up for methods to
> intercept. The parameters comparison (to check is
> method parameter and aspect parameters are from same
> type) is made in the following way:
>
> return (p1.TypeName.ToString() ==
> p2.TypeName.ToString());
> Where p1 and p2 are instances of Parameter.
>
> The problem occurs in the code that I showed above. In
> the method the type of parameters is write “MainCls”
> and in the aspect “XXXX.MainCls”. So the compression
> returns false, and that aspect in not binded for
> “Toto” method.
>
> There is another way to check parameters type? :D
You can just compare the types, there is no need to use string
representations.
Also the parameters are all encapsulated, so you might want to add an
operator== to compare parameters in two methods.
Miguel
More information about the Mono-list
mailing list