question about multiple attribute

  • Thread starter Thread starter john
  • Start date Start date
J

john

I cannot understand the following words.Anybody can
explain to me? Thanks in advance.

"For a few attributes, however, it does make sense to
apply the attribute multiple times to a single target. In
the FCL, the ConditionalAttribute attribute class and
lots of permission attribute classes (such as
EnvironmentPermissionAttribute,
FileIOPermissionAttribute, ReflectionPermissionAttribute,
Registry PermissionAttribute, and so on) allow multiple
instances of themselves to be applied toa single target."
 
john said:
I cannot understand the following words.Anybody can
explain to me? Thanks in advance.

"For a few attributes, however, it does make sense to
apply the attribute multiple times to a single target. In
the FCL, the ConditionalAttribute attribute class and
lots of permission attribute classes (such as
EnvironmentPermissionAttribute,
FileIOPermissionAttribute, ReflectionPermissionAttribute,
Registry PermissionAttribute, and so on) allow multiple
instances of themselves to be applied toa single target."

Well, which bit don't you understand? It's hard to explain without
basically saying the same thing again :)

Here's an example instead - you might want two registry permission
attributes for a single method, one to read one section of the registry
and one to write another. You'd just apply both of them:

[RegistryPermissionAttribute(SecurityAction.Demand, Read="...")]
[RegistryPermissionAttribute(SecurityAction.Demand, Write="...")]
public void DoSomething()
{
....
}
 
Back
Top