Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / Visual J# / February 2005

Tip: Looking for answers? Try searching our database.

Custom Attributes in J#

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Avid J# Programmer - 28 Jan 2005 21:05 GMT
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
Avid J# Programmer - 28 Jan 2005 21:59 GMT
oops, small typo, it should say custom instead of customer on the first line

> 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
[quoted text clipped - 16 lines]
> --
> http://www.hungryshadow.com
Lars-Inge T?nnessen [VJ# MVP] - 28 Jan 2005 22:56 GMT
> Is it possible to define customer attributes in a J# application? I've
> seen

Please see:

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


Regards,
Lars-Inge T?nnessen
Bruno Jouhier [MVP] - 30 Jan 2005 11:49 GMT
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
[quoted text clipped - 20 lines]
> --
> http://www.hungryshadow.com 
SamAbo - 28 Feb 2005 23:43 GMT
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; }
}

> You cannot do it with VS 2003 (you can "consume" attributes in J# but you
> cannot "author" them).
[quoted text clipped - 29 lines]
> > --
> > http://www.hungryshadow.com 

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.