Custom attributes C#
Sclytrack
sclytrack at pi.be
Wed Sep 26 12:33:25 PDT 2007
Could D have custom attributes like in C# ?
public class MyCustomAttribute:Attribute
{
public MyCustomAttribute( string text)
{
}
...
}
class MyClass
{
[MyCustom("my text")]
void DoStuff()
{
}
}
The attributes can then be retrieved by system reflection. An attribute is
a class thus can contain code.
I was thinking of something similar in D, but simpler
attribute published; // published would then be an attribute.
class Window
{
attr(published) void caption(char [] text)
{
}
}
__traits( allAttributes, )
and maybe dropping the two underscores in the __traits
#d.lounge Arthur, give Zuu a cookie.
More information about the Digitalmars-d
mailing list