Custom attributes C#

Daniel Keep daniel.keep.lists at gmail.com
Thu Sep 27 05:11:08 PDT 2007



Janice Caron wrote:
> On 9/26/07, Sclytrack <sclytrack at pi.be> wrote:
>> Could D have custom attributes like in C# ?
> 
> Please could you explain this for the benefit of those of us who do
> not speak C#?

class Foo
{
    [SerialiseAs("bar")] int _bar;
    [DontSerialiseAtAll] void* _someCachedThing;
}

class ControllerWidget
{
    [GuiLabel("First Name"),GuiControl("TextBox")]
    string firstName;
    [GuiLabel("Last Name"),GuiControl("TextBox")]
    string lastName;

    [GuiLabel("Update records"),GuiControl("Button")]
    void update() { ... }
}

	-- Daniel



More information about the Digitalmars-d mailing list