April 2002
Intermediate to advanced
816 pages
20h 56m
English
As you can see, there are several different uses of permissions in the .NET Framework. Because of the wide range of uses, there are two different ways to express security actions: declaratively and imperatively. Listing 6.2 shows the same permission demand expressed in both forms.
// Declarative form
[FileIOPermission(SecurityAction.Demand, Read=@"C:\Payroll.doc")]
public void MyMethod()
{
}
// Imperative form
public void MyMethod()
{
new FileIOPermission(FileIOPermissionAccess.Read, @"C:\Payroll.doc").Demand();
}
|
The primary difference between imperative and declarative forms of security actions is that declarative forms are stored ...