แก้ไข

แชร์ผ่าน


NetworkInformationPermission.Access Property

Definition

Gets the level of access to network information controlled by this permission.

public:
 property System::Net::NetworkInformation::NetworkInformationAccess Access { System::Net::NetworkInformation::NetworkInformationAccess get(); };
public System.Net.NetworkInformation.NetworkInformationAccess Access { get; }
member this.Access : System.Net.NetworkInformation.NetworkInformationAccess
Public ReadOnly Property Access As NetworkInformationAccess

Property Value

One of the NetworkInformationAccess values.

Examples

The following code example creates a NetworkInformationPermission, adds a NetworkInformationAccess value to it, and displays the value of this property.

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

A NetworkInformationPermission created with PermissionState.Unrestricted is given Ping | Read access. A NetworkInformationPermission created with PermissionState.None is given None access.

Applies to