NetworkInformationPermission.IsUnrestricted 方法

定义

返回一个值,该值指示当前权限是否不受限制。

public:
 virtual bool IsUnrestricted();
public bool IsUnrestricted ();
abstract member IsUnrestricted : unit -> bool
override this.IsUnrestricted : unit -> bool
Public Function IsUnrestricted () As Boolean

返回

如果当前权限不受限制,则为 true;否则为 false

实现

示例

以下示例创建权限对象并显示其状态。

System::Net::NetworkInformation::NetworkInformationPermission^ unrestricted = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::Unrestricted );

Console::WriteLine( L"Is unrestricted? {0}", unrestricted->IsUnrestricted() );
System.Net.NetworkInformation.NetworkInformationPermission unrestricted =
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Security.Permissions.PermissionState.Unrestricted);

Console.WriteLine("Is unrestricted? " + unrestricted.IsUnrestricted());
Dim unrestricted As New System.Net.NetworkInformation.NetworkInformationPermission( _
    System.Security.Permissions.PermissionState.Unrestricted)
Console.WriteLine("Is unrestricted? " + unrestricted.IsUnrestricted().ToString())

注解

使用 NetworkInformationPermission 构造函数创建不受限制的权限。

适用于