ערוך

שתף באמצעות


ResourcePermissionBase.AddPermissionAccess Method

Definition

Adds a permission entry to the permission.

protected:
 void AddPermissionAccess(System::Security::Permissions::ResourcePermissionBaseEntry ^ entry);
protected void AddPermissionAccess (System.Security.Permissions.ResourcePermissionBaseEntry entry);
member this.AddPermissionAccess : System.Security.Permissions.ResourcePermissionBaseEntry -> unit
Protected Sub AddPermissionAccess (entry As ResourcePermissionBaseEntry)

Parameters

Exceptions

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

-or-

The ResourcePermissionBaseEntry is already included in the permission.

Examples

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.

MailslotPermission( MailslotPermissionAccess permissionAccess, String^ name, String^ machineName )
{
   SetNames();
   this->AddPermissionAccess( gcnew MailslotPermissionEntry( permissionAccess,name,machineName ) );
}

MailslotPermission( array<MailslotPermissionEntry^>^permissionAccessEntries )
{
   SetNames();
   if ( permissionAccessEntries == nullptr )
         throw gcnew ArgumentNullException( "permissionAccessEntries" );

   for ( int index = 0; index < permissionAccessEntries->Length; ++index )
      this->AddPermissionAccess( permissionAccessEntries[ index ] );
}
public MailslotPermission(MailslotPermissionAccess permissionAccess, string name, string machineName)
{
    SetNames();
    this.AddPermissionAccess(new MailslotPermissionEntry(permissionAccess, name, machineName));
}

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

    for (int index = 0; index < permissionAccessEntries.Length; ++index)
        this.AddPermissionAccess(permissionAccessEntries[index]);
}
Public Sub New(ByVal permissionAccess As MailslotPermissionAccess, ByVal name As String, ByVal machineName1 As String)
    SetNames()
    Me.AddPermissionAccess(New MailslotPermissionEntry(permissionAccess, name, machineName1))
End Sub


Public Sub New(ByVal permissionAccessEntries() As MailslotPermissionEntry)
    SetNames()
    If permissionAccessEntries Is Nothing Then
        Throw New ArgumentNullException("permissionAccessEntries")
    End If
    Dim index As Integer

    While index < permissionAccessEntries.Length
        Me.AddPermissionAccess(permissionAccessEntries(index))
    End While
End Sub

Applies to

See also