Attribute scope

  • Thread starter Thread starter news.microsoft.com
  • Start date Start date
N

news.microsoft.com

Hi,

What is the scope rules for attributes?

For example if i have the following


[Description("Some blah blah bork bork")]
[SomeOtherAttribute("Something")]
public int Blah;



WHat is the scope of this, is it always applying to the item after the
attribute and only that until the next statement?

[Description("Some blah blah bork bork")]
[SomeOtherAttribute("Something")]


public int Blah;


Doesnt matter what spacing I have between them as long as I only have the
statement that I wish it to apply to right immediately after the attribute?
 
Hi,

What is the scope rules for attributes?
[...]
Doesnt matter what spacing I have between them as long as I only
have the
statement that I wish it to apply to right immediately after the
attribute?

If there is no hint, then the attribute applies to the next member in the
code.
You can also define attributes with a fixed scope, like
[assembly:someattribute(...)]

greets
Peter

--
------ooo---OOO---ooo------

Peter Koen - www.kema.at
MCAD CAI/RS CASE/RS IAT

------ooo---OOO---ooo------
 
Back
Top