NetworkInformationPermission.Access 属性

定义

获取对此权限控制的网络信息的访问级别。

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

属性值

NetworkInformationAccess 值之一。

示例

下面的代码示例创建 一个 NetworkInformationPermission,向它添加一个 NetworkInformationAccess 值,并显示此属性的值。

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)

注解

使用 NetworkInformationPermissionPermissionState.Unrestricted 创建的 将被授予ReadPing | 访问权限。 使用 NetworkInformationPermissionPermissionState.None 创建的 将被授予 None 访问权限。

适用于