Attributes (intrinsic/pre-defined/standard)

  • Thread starter Thread starter Jim Trela
  • Start date Start date
J

Jim Trela

How can I find out the names of all the attributes that
are intrinsic (pre-defined, or standard) in the .NET
framework ? I saw in a presentation that there are
supposedly around 178 pre-defined ones. I know that it is
possible to define your own, but I want to know what the
standard ones are, besides [Webmethod] and [Serializable].
I did try searching the the help alphabetically ([a*],
[b*], ...), but my query was not limited to the results I
expected.

Also, since the interface "ISerializable" is also
implemented as an attribute ([Serializable] ?), is EVERY
interface implemented as an attribute ? Conversely, does
every attribute have a counterpart that is an interface ?
For instance, I don't believe that "[Webmethod]" has a
corresponding interface named something like "IWebmethod".
 
Jim,
How can I find out the names of all the attributes that
are intrinsic (pre-defined, or standard) in the .NET
framework ?

See

http://msdn.microsoft.com/library/en-us/cpref/html/frlrfsystemattributeclasshierarchy.asp

Or open up Wincv.exe and type in "Attribute".


Also, since the interface "ISerializable" is also
implemented as an attribute ([Serializable] ?), is EVERY
interface implemented as an attribute ?
No


Conversely, does
every attribute have a counterpart that is an interface ?

No



Mattias
 
I don't know of any list that shows all the attributes. You could write
something that would iterate over all the classes in all the assemblies and
list those that derive from System.Assembly.

[Serializable] is the attribute used to indicate that a class can be
serialized. ISerializable is used to provide customer serialization for a
class. They're related, but not the same thing.

--
Eric Gunnerson

Visit the C# product team at http://www.csharp.net
Eric's blog is at http://blogs.gotdotnet.com/ericgu/

This posting is provided "AS IS" with no warranties, and confers no rights.
 
Back
Top