แก้ไข

แชร์ผ่าน


NetworkInformationPermission.AddPermission(NetworkInformationAccess) Method

Definition

Adds the specified value to this permission.

public:
 void AddPermission(System::Net::NetworkInformation::NetworkInformationAccess access);
public void AddPermission (System.Net.NetworkInformation.NetworkInformationAccess access);
member this.AddPermission : System.Net.NetworkInformation.NetworkInformationAccess -> unit
Public Sub AddPermission (access As NetworkInformationAccess)

Parameters

Examples

The following example creates an empty permission object and then adds to it.

System::Net::NetworkInformation::NetworkInformationPermission^ permission = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::None );
permission->AddPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read );
Console::WriteLine( L"Access is {0}", permission->Access );
System.Net.NetworkInformation.NetworkInformationPermission permission =
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Security.Permissions.PermissionState.None);
permission.AddPermission(
        System.Net.NetworkInformation.NetworkInformationAccess.Read);
Console.WriteLine("Access is {0}", permission.Access);
Dim permission As New System.Net.NetworkInformation.NetworkInformationPermission( _
    System.Security.Permissions.PermissionState.None)
permission.AddPermission(System.Net.NetworkInformation.NetworkInformationAccess.Read)
Console.WriteLine("Access is {0}", permission.Access)

Remarks

Use this method to modify access to network information by adding to the state of the current permission.

Applies to