validate attribute usage

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • tolisss

    validate attribute usage



    Hi

    i have to custom attributes for using with properties.
    What i want to do is instruct the compiler to throw a warning or ever
    better an error if both attributes are used in the same property. Is it
    possible? any ideas?

    thnks in advance

    *** Sent via Developersdex http://www.developersdex.com ***
  • Nicholas Paldino [.NET/C# MVP]

    #2
    Re: validate attribute usage

    tolisss,

    Unfortunately, custom attributes don't provide a hook through which
    compiler checks can be done.

    However, what you could do in .NET 2.0 is modify the MSBUILD script to
    check the output after it is built. You can reflect on the produced
    assemblies and see if the attributes are applied appropriately.

    Hope this helps.


    --
    - Nicholas Paldino [.NET/C# MVP]
    - mvp@spam.guard. caspershouse.co m

    "tolisss" <nospam@devdex. com> wrote in message
    news:OOKQms5OFH A.3560@TK2MSFTN GP14.phx.gbl...[color=blue]
    >
    >
    > Hi
    >
    > i have to custom attributes for using with properties.
    > What i want to do is instruct the compiler to throw a warning or ever
    > better an error if both attributes are used in the same property. Is it
    > possible? any ideas?
    >
    > thnks in advance
    >
    > *** Sent via Developersdex http://www.developersdex.com ***[/color]


    Comment

    Working...