Re: Custom Attributes in J#

From: Bruno Jouhier [MVP] (bjouhier_at_club-internet.fr)
Date: 01/30/05


Date: Sun, 30 Jan 2005 12:49:18 +0100

You cannot do it with VS 2003 (you can "consume" attributes in J# but you
cannot "author" them).
You will be able to do it with the upcoming VS 2005.

Bruno.

"Avid J# Programmer" <AvidJProgrammer@discussions.microsoft.com> a écrit
dans le message de news:
88A95F0A-90EB-435D-8072-EC3EFAE16978@microsoft.com...
> Is it possible to define customer attributes in a J# application? I've
> seen
> it done in C#, but i tried it in J# and it wouldn't work. I tried the
> following code:
>
> /** @attribute System.AttributeUsage (System.AttributeTargets.Assembly) */
> public class BuildLocationAttribute extends Attribute
> {
> private String BuildLocation;
> public BuildLocationAttribute(String bl){BuildLocation = bl;}
> public String getBuildLocation(){return BuildLocation;}
> }
>
> and I get an error saying "Cannot author attributes, enums or value
> types".
> It doesn't seem to like the fact that i'm extending from the Attribute
> class
>
> Is there a way around this? I just want to state the build location inside
> the application exe's Version Tab in the file properties. Any help with
> this
> would be greatly appreciated =)
> --
> http://www.hungryshadow.com


Loading