[Kde-bindings] Using Attributes on static methods in C# in Qyoto

Arno Rehn arno at arnorehn.de
Sat Feb 3 20:44:51 UTC 2007


Am Freitag, 2. Februar 2007 schrieb Richard Dale:
> I had planned on speeding up the lookup of methods in the Smoke library
> from their 'munged method name', classname and arg type signatures, by
> getting the munged name from the 'SmokeMethod' attribute like this:
> [...]
> So instead of deriving the munged name at runtime from the types of the C#
> arguments, get it straight from the Attribute instance. Then when the Smoke
> methodId has been found, cache it inside the Attribute rather than
> maintaining a Hash.
Good idea, makes the bindings probably a lot faster.

> And it works fine with instance methods, but with static methods that
> Attribute isn't retrieved. So this doesn't work for instance:
> [...]
> I was hoping there would be a special AttributeTargets flag for static
> methods, but can't find one. I can't find any reference in the docs to
> Attributes not working with static methods, so it's a bit frustrating..
Hmm, that's funny. You should be able to apply attributes to static methods, 
too. Otherwise attributes like STAThread wouldn't work, as they are applied 
to the static Main() method.

-- 
Arno Rehn
arno at arnorehn.de



More information about the Kde-bindings mailing list