ResourcePermissionBase.AddPermissionAccess Method (ResourcePermissionBaseEntry)


The .NET API Reference documentation has a new home. Visit the .NET API Browser on to see the new experience.

Adds a permission entry to the permission.

Namespace:   System.Security.Permissions
Assembly:  System (in System.dll)

protected void AddPermissionAccess(
	ResourcePermissionBaseEntry entry

Exception Condition

The specified ResourcePermissionBaseEntry is null.


The number of elements in the ResourcePermissionBaseEntry.PermissionAccessPath property is not equal to the number of elements in the ResourcePermissionBase.TagNames property.


The ResourcePermissionBaseEntry is already included in the permission.

The following example shows the use of the AddPermissionAccess method to add a permission access entry during class initialization. This code example is part of a larger example provided for the ResourcePermissionBase class.

public MailslotPermission(MailslotPermissionAccess permissionAccess, string name, string machineName)
	this.AddPermissionAccess(new MailslotPermissionEntry(permissionAccess, name, machineName));              

public MailslotPermission(MailslotPermissionEntry[] permissionAccessEntries) 
	if (permissionAccessEntries == null)
		throw new ArgumentNullException("permissionAccessEntries");

	for (int index = 0; index < permissionAccessEntries.Length; ++index)

.NET Framework
Available since 1.1
Return to top