Прочетете на английски Редактиране

Споделяне чрез


UIPermission Constructors

Definition

Initializes a new instance of the UIPermission class.

Overloads

UIPermission(PermissionState)

Initializes a new instance of the UIPermission class with either fully restricted or unrestricted access, as specified.

UIPermission(UIPermissionClipboard)

Initializes a new instance of the UIPermission class with the permissions for the Clipboard, and no access to windows.

UIPermission(UIPermissionWindow)

Initializes a new instance of the UIPermission class with the permissions for windows, and no access to the Clipboard.

UIPermission(UIPermissionWindow, UIPermissionClipboard)

Initializes a new instance of the UIPermission class with the specified permissions for windows and the Clipboard.

UIPermission(PermissionState)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with either fully restricted or unrestricted access, as specified.

C#
public UIPermission(System.Security.Permissions.PermissionState state);

Parameters

state
PermissionState

One of the enumeration values.

Exceptions

The state parameter is not a valid PermissionState.

Examples

The following code example shows the use of the UIPermission constructor. This example is part of a larger example provided for the UIPermission class.

C#
UIPermission uiPerm2 = new UIPermission(PermissionState.None);

Remarks

This constructor creates either the fully restricted (None) or the Unrestricted form of the permission.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

UIPermission(UIPermissionClipboard)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with the permissions for the Clipboard, and no access to windows.

C#
public UIPermission(System.Security.Permissions.UIPermissionClipboard clipboardFlag);

Parameters

clipboardFlag
UIPermissionClipboard

One of the enumeration values.

Exceptions

The clipboardFlag parameter is not a valid UIPermissionClipboard value.

Examples

The following code example shows the use of the UIPermission.UIPermission(UIPermissionClipboard) constructor. This example is part of a larger example provided for the UIPermission class.

C#
uiPerm1 = new UIPermission(UIPermissionClipboard.AllClipboard);

Remarks

To set both the Clipboard and window permissions, use the constructor that takes parameters for both.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

UIPermission(UIPermissionWindow)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with the permissions for windows, and no access to the Clipboard.

C#
public UIPermission(System.Security.Permissions.UIPermissionWindow windowFlag);

Parameters

windowFlag
UIPermissionWindow

One of the enumeration values.

Exceptions

The windowFlag parameter is not a valid UIPermissionWindow value.

Examples

The following code example shows the use of the UIPermission.UIPermission(UIPermissionWindow) constructor. This example is part of a larger example provided for the UIPermission class.

C#
UIPermission uiPerm1 = new UIPermission(UIPermissionWindow.SafeTopLevelWindows);

Remarks

To set both the Clipboard and window permissions, use the constructor that takes parameters for both.

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10

UIPermission(UIPermissionWindow, UIPermissionClipboard)

Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs
Source:
UIPermission.cs

Initializes a new instance of the UIPermission class with the specified permissions for windows and the Clipboard.

C#
public UIPermission(System.Security.Permissions.UIPermissionWindow windowFlag, System.Security.Permissions.UIPermissionClipboard clipboardFlag);

Parameters

windowFlag
UIPermissionWindow

One of the enumeration values.

clipboardFlag
UIPermissionClipboard

One of the enumeration values.

Exceptions

The windowFlag parameter is not a valid UIPermissionWindow value.

-or-

The clipboardFlag parameter is not a valid UIPermissionClipboard value.

Examples

The following code example shows the use of the UIPermission.UIPermission(UIPermissionWindow, UIPermissionClipboard) constructor. This example is part of a larger example provided for the UIPermission class.

C#
UIPermission uiPerm1 = new UIPermission(UIPermissionWindow.SafeTopLevelWindows, UIPermissionClipboard.OwnClipboard);

Applies to

.NET 10 (package-provided) и други версии
Продукт Версии
.NET 8 (package-provided), 9 (package-provided), 10 (package-provided)
.NET Framework 1.1, 2.0, 3.0, 3.5, 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0 (package-provided)
Windows Desktop 3.0, 3.1, 5, 6, 7, 8, 9, 10