NetworkInformationPermission.Access 属性

定义

获取对此权限控制的网络信息的访问级别。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

属性值

NetworkInformationAccess

NetworkInformationAccess 值之一。One of the NetworkInformationAccess values.

示例

下面的代码示例创建一个 NetworkInformationPermission ,将一个 NetworkInformationAccess 值添加到它,并显示此属性的值。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)

注解

NetworkInformationPermission PermissionState.Unrestricted Ping | 访问权限提供了创建的 ReadA NetworkInformationPermission created with PermissionState.Unrestricted is given Ping | Read access. NetworkInformationPermission 创建的提供 PermissionState.None None 访问权限。A NetworkInformationPermission created with PermissionState.None is given None access.

适用于