NetworkInformationPermission 构造函数

定义

初始化 NetworkInformationPermission 类的新实例。

重载

NetworkInformationPermission(NetworkInformationAccess)

使用指定的 NetworkInformationAccess 值初始化 NetworkInformationPermission 类的新实例。

NetworkInformationPermission(PermissionState)

使用指定的 NetworkInformationPermission 初始化 PermissionState 类的新实例。

NetworkInformationPermission(NetworkInformationAccess)

Source:
NetworkInformationPermission.cs
Source:
NetworkInformationPermission.cs
Source:
NetworkInformationPermission.cs
Source:
NetworkInformationPermission.cs

使用指定的 NetworkInformationAccess 值初始化 NetworkInformationPermission 类的新实例。

public:
 NetworkInformationPermission(System::Net::NetworkInformation::NetworkInformationAccess access);
public NetworkInformationPermission (System.Net.NetworkInformation.NetworkInformationAccess access);
new System.Net.NetworkInformation.NetworkInformationPermission : System.Net.NetworkInformation.NetworkInformationAccess -> System.Net.NetworkInformation.NetworkInformationPermission
Public Sub New (access As NetworkInformationAccess)

参数

示例

以下示例创建一个权限对象,该对象控制对网络信息的访问。

System::Net::NetworkInformation::NetworkInformationPermission^ read = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read );
System.Net.NetworkInformation.NetworkInformationPermission read =
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Net.NetworkInformation.NetworkInformationAccess.Read);
Dim read As New System.Net.NetworkInformation.NetworkInformationPermission( _ 
    System.Net.NetworkInformation.NetworkInformationAccess.Read)

注解

此构造函数创建的权限可用于保护对网络信息的访问。

适用于

NetworkInformationPermission(PermissionState)

Source:
NetworkInformationPermission.cs
Source:
NetworkInformationPermission.cs
Source:
NetworkInformationPermission.cs
Source:
NetworkInformationPermission.cs

使用指定的 NetworkInformationPermission 初始化 PermissionState 类的新实例。

public:
 NetworkInformationPermission(System::Security::Permissions::PermissionState state);
public NetworkInformationPermission (System.Security.Permissions.PermissionState state);
new System.Net.NetworkInformation.NetworkInformationPermission : System.Security.Permissions.PermissionState -> System.Net.NetworkInformation.NetworkInformationPermission
Public Sub New (state As PermissionState)

参数

state
PermissionState

PermissionState 值之一。

示例

以下示例创建一个不受限制的权限对象。

System::Net::NetworkInformation::NetworkInformationPermission^ unrestricted = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::Unrestricted );
System.Net.NetworkInformation.NetworkInformationPermission unrestricted =
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Security.Permissions.PermissionState.Unrestricted);
Dim unrestricted As New System.Net.NetworkInformation.NetworkInformationPermission( _
    System.Security.Permissions.PermissionState.Unrestricted)

注解

此构造函数创建的权限可用于保护对网络信息的访问。

适用于