all groups > vj# > january 2005 >
You're in the

vj#

group:

Custom Attributes in J#


Custom Attributes in J# Avid J# Programmer
1/28/2005 1:05:03 PM
vj#: 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 =)
--
RE: Custom Attributes in J# Avid J# Programmer
1/28/2005 1:59:01 PM
oops, small typo, it should say custom instead of customer on the first line

[quoted text, click to view]
Re: Custom Attributes in J# Lars-Inge Tønnessen [VJ# MVP]
1/28/2005 11:56:12 PM

[quoted text, click to view]

Please see:

http://msdn.microsoft.com/library/en-us/dv_vjsharp/html/vjgrfUnsupportedNETFeatures.asp


Regards,
Lars-Inge Tønnessen

Re: Custom Attributes in J# Bruno Jouhier [MVP]
1/30/2005 12:49:18 PM
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...
[quoted text, click to view]

Re: Custom Attributes in J# SamAbo
2/28/2005 3:43:03 PM
I compiled the code using VS 2005, and it worked. I made a tiny change though
by using System.Attribute instead od Attribute:

/** @attribute System.AttributeUsage (System.AttributeTargets.Assembly) */
public class BuildLocationAttribute extends System.Attribute
{
private String BuildLocation;
public BuildLocationAttribute(String bl) { BuildLocation = bl; }
public String getBuildLocation() { return BuildLocation; }
}


[quoted text, click to view]
AddThis Social Bookmark Button