Bookmarks

Yahoo Gmail Google Facebook Delicious Twitter Reddit Stumpleupon Myspace Digg

Search queries

078274121, info0a ip, should prodicers of software_based services be held liable or not liable for economic injuries, should producers of soft ware based services such as ATMs be held liable for economic injuries suffered when their systems fail?, nisc wwwxxx, wwwxxx0cm, should producers of software-based services, such as atms, be held liable for economic injuries suffered when their systems fail?, wwwxxx0cm, www.webdp.net, Event 9 IIS log failed to write entry

Links

XODOX
Impressum

#1: How to write a .NET attribute which does just like ObsoleteAttribute...

Posted on 2008-04-24 14:26:46 by gw2ksoft

Hi,

In .NET there is attribute named ObsoleteAttribute which is derived from
System.Attribute Class. This attribute when applied to a target (class or
method etc.) gives a compiler warning/error. I know we can write our own
attributes by inheriting the System.Attribute but I want to make it give
compiler warning or error when it is applied on the defined attribute
target.

How can we write such an attributes?

Regards,
Ashok G

Report this message

#2: Re: How to write a .NET attribute which does just like

Posted on 2008-04-24 14:42:13 by Marc Gravell

You can't... ObsoleteAttribute is handled as a special-case by the
compiler, not by anything extensible.

What do you want to check, in particular? There may be other ways of
doing it...

Marc

Report this message

#3: Re: How to write a .NET attribute which does just like

Posted on 2008-04-24 15:45:11 by ignacio.machin

On Apr 24, 8:26=A0am, "AshokG" <gw2ks...@hotmail.com> wrote:
> Hi,
>
> In .NET there is attribute named ObsoleteAttribute which is derived from
> System.Attribute Class. This attribute when applied to a target (class or
> method etc.) gives a compiler warning/error. I know we can write our own
> attributes by inheriting the System.Attribute but I want to =A0make it giv=
e
> compiler warning or error when it is applied on the defined attribute
> target.
>
> How can we write such an attributes?
>
> Regards,
> Ashok G

Hi,

AFAIK there is no way of doing that. The compiler knows a given number
of attributes and have CODED actions for them.
You would need to write a new compiler :)

Report this message