is there a faq about the square bracket thingies in c#

  • Thread starter Thread starter alexl
  • Start date Start date
A

alexl

hi,

is there a faq that explains what the square brackets are and what are
the available keywords you can use in them?

e.g.

[System.Security.Permissions.PermissionSet
(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
protected override void WndProc(ref Message m)
{
 
is there a faq that explains what the square brackets are and what are
the available keywords you can use in them?

e.g.

[System.Security.Permissions.PermissionSet
(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
protected override void WndProc(ref Message m)
{

What you're seeing there is known as an Attribute. Documentation here:

(VS 2005) http://msdn.microsoft.com/en-us/library/z0w1kczw(VS.80).aspx
(VS 2008) http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx
 
is there a faq that explains what the square brackets are and what are
the available keywords you can use in them?

e.g.

[System.Security.Permissions.PermissionSet
(System.Security.Permissions.SecurityAction.Demand, Name="FullTrust")]
protected override void WndProc(ref Message m)
{

What you're seeing there is known as an Attribute. Documentation here:

(VS 2005) http://msdn.microsoft.com/en-us/library/z0w1kczw(VS.80).aspx
(VS 2008) http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx

Forgot to add: as far a getting a list of what's available for what...good
luck. I've never seen any documentation that says something like "This
class/function/whatever can be modifed with the following attributes: ..."
Your best bet is probably to look through a namespace and find any type with
"Atribute" on the end and then read its description.
 
Jeff said:
is there a faq that explains what the square brackets are and what
are the available keywords you can use in them?

e.g.

[System.Security.Permissions.PermissionSet
(System.Security.Permissions.SecurityAction.Demand,
Name="FullTrust")] protected override void WndProc(ref
Message m) {

What you're seeing there is known as an Attribute. Documentation
here: (VS 2005)
http://msdn.microsoft.com/en-us/library/z0w1kczw(VS.80).aspx (VS
2008) http://msdn.microsoft.com/en-us/library/z0w1kczw.aspx

Forgot to add: as far a getting a list of what's available for
what...good luck. I've never seen any documentation that says
something like "This class/function/whatever can be modifed with the
following attributes: ..." Your best bet is probably to look through
a namespace and find any type with "Atribute" on the end and then
read its description.

But while it's good practice to name attribute classes ending in
"Attribute", it's not required. Better to use .NET Reflector to list all
classes inheriting from Attribute.
 
Back
Top