AW: [Mono-list] Question about attributes

Jochen Wezel jwezel@compumaster.de
Thu, 29 Apr 2004 14:15:34 +0200


In the upcoming release of VB.NET 2005 of MS, those XML tags in VB are =
supported. You can already taste that in the VS.NET 2005 beta.

The syntax is very similar to the C# writing style except that you use =
''' instead of /// at the beginning of the line. Then you can build the =
DLL normally and the XML file can be created with the new VS.NET 2005. =
Alternatively and as I remember, there is a VBDoc project somewhere on =
sourceforge.net which might be able to extract those XML tags.

-Jochen


-----Urspr=FCngliche Nachricht-----
Von: mono-list-admin@lists.ximian.com =
[mailto:mono-list-admin@lists.ximian.com] Im Auftrag von xiii29@free.fr
Gesendet: Donnerstag, 29. April 2004 13:35
An: mono-list@lists.ximian.com; Jonathan Stowe
Betreff: Re: [Mono-list] Question about attributes


Ok, so there is no recommendation about attributes to use in mono for =
documentation...

I don't want using XML tags as it doesn't work with VB.Net by default (I
think...) and you have to deliver : assembly and XML file ... So I will =
create some attributes !

Thanks for all the answer !

Thierry


Selon Jonathan Stowe <gellyfish@gellyfish.com>:

> On Thu, 2004-04-29 at 07:56, xiii29@free.fr wrote:
> > Hi,
> >=20
> > First : Thanks for the explanation ;-)
> >=20
> > But my question what about which attributes using in order to=20
> > document
> methods
> > or function in my code.
> >=20
> > For example, if you want the Visual Studio .Net Property Panel to be =

> > able
> to
> > display info about your properties you have to use=20
> > System.ComponentModel.Description("The description").
> >=20
>=20
> You can do just the same with mono:
>=20
> using System;
> using System.ComponentModel;
>                                                                        =
     =20
>  =20
> class MyTest
> {
>         [Description("Test")]
>         public void whatever()
>         {
>                          =20
>         }
> }
>=20
> Will work (i.e. compile) just fine.  Whether or not it is any use is=20
> whether the tools you want to use can get at this information.  The=20
> DescriptionAttribute is used for design time purposes (i.e. to display =

> in the properties panel of a visual tool) rather than strictly for=20
> documentation, if you want to autogenerate documentation from your=20
> code you might me better of using the XML documentation comments=20
> rather than this.
>=20
> Of course you can create your own attributes by inheriting from=20
> System.Attribute as documented on MSDN and elsewhere.
>=20
> /J\
>=20
> > This is a Visual Studio .Net rules.
> >=20
> > Now my question is : of I want to add documention to my methods,=20
> > class
> etc...=20
> > which meta-attributes do I use ?=20
> >=20
> > Maybe there is no dedicated attributes and I will have to create my
> owns...
> >=20
> > Thierry !
> >=20
> >=20
> > Selon Jonathan Pryor <jonpryor@vt.edu>:
> >=20
> > > On Wed, 2004-04-28 at 16:46, Xiii29 wrote:
> > > > I've question about attributes in Mono. I would like to comment=20
> > > > my assemblys by using attributes (meta-attributes...) and i'm=20
> > > > wondering
> if
> > > > there is "rules" (or preconisations...) about which attributes
> using...
> > >=20
> > > I'm pretty sure I don't understand your question at all.  But I'll =

> > > take a shot anyway...
> > >=20
> > > To use an assembly-level attribute, you need to explicitly specify =

> > > what the attribute is associated with.  For example:
> > >=20
> > > 	[assembly: AssemblyTitle ("my title")]
> > > 	[assembly: AssemblyVersion ("1.0.*")]
> > >=20
> > > The "assembly:" indicates that the attribute applies to the =
assembly.=20
> > > Otherwise it would apply to the next member listed in the file=20
> > > (delegate, class, structure, etc.) or generate an error=20
> > > (namespaces don't support attributes).  Similar things can be done =

> > > for other elements; for example: "return:" can be used to place an =

> > > attribute on the return type of a method, while normally the=20
> > > attribute applies to the method itself:
> > >=20
> > > 	[SomeAttribute ("applies to MyMethod")]
> > > 	[return: SomeAttribute ("applies to the return type")]
> > > 	int MyMethod () {return 42;}
> > >=20
> > > As for general rules...  You can only use attributes which can be=20
> > > applied to an assembly; that is, the attribute you're trying to=20
> > > use must itself have an AttributeUsage attribute with=20
> > > AttributeTargets.Assembly specified.  Not all attributes do this;=20
> > > the DllImport attribute, for example, can only be applied to =
methods.
> > >=20
> > > Aside from that, the normal attribute restrictions apply.  Which=20
> > > means that attribute positional and named parameters can only be:=20
> > > one of the CLS-compliant built-in types (bool, byte, char, double, =

> > > float, int, long, short, string); System.Type, an enum type;=20
> > > System.Object; or an array of one of the previous types.
> > >=20
> > > See a good C# book, or MSDN, or google, for more information.
> > >=20
> > >  - Jon
> > >=20
> > >=20
> > >=20
> >=20
> >=20
> > _______________________________________________
> > Mono-list maillist  -  Mono-list@lists.ximian.com=20
> > http://lists.ximian.com/mailman/listinfo/mono-list
>=20
> _______________________________________________
> Mono-list maillist  -  Mono-list@lists.ximian.com=20
> http://lists.ximian.com/mailman/listinfo/mono-list
>=20


_______________________________________________
Mono-list maillist  -  Mono-list@lists.ximian.com =
http://lists.ximian.com/mailman/listinfo/mono-list