WebPermission.Copy 方法

定义

创建 WebPermission 的副本。Creates a copy of a WebPermission.

public:
 override System::Security::IPermission ^ Copy();
public override System.Security.IPermission Copy ();
override this.Copy : unit -> System.Security.IPermission
Public Overrides Function Copy () As IPermission

返回

WebPermission 类的新实例,该实例与原始对象具有相同的值。A new instance of the WebPermission class that has the same values as the original.

示例

下面的示例演示如何使用 Copy创建 WebPermission 的第二个实例。The following example demonstrates how to create a second instance of WebPermission using Copy. 此第二个实例与第一个实例相同。This second instance is identical to the first.

// Create another WebPermission instance that is the copy of the above WebPermission instance.
WebPermission^ myWebPermission2 = (WebPermission^)(myWebPermission1->Copy());

// Check whether all callers higher in the call stack have been granted the permissionor not.
myWebPermission2->Demand();
 // Create another WebPermission instance that is the copy of the above WebPermission instance.
  WebPermission myWebPermission2 = (WebPermission) myWebPermission1.Copy();

 // Check whether all callers higher in the call stack have been granted the permissionor not.
 myWebPermission2.Demand();

' Create another WebPermission instance that is the copy of the above WebPermission instance.
Dim myWebPermission2 As WebPermission = CType(myWebPermission1.Copy(), WebPermission)

' Check whether all callers higher in the call stack have been granted the permissionor not.
myWebPermission2.Demand()

注解

此方法返回的 IPermission 表示与原始 WebPermission相同的资源访问权限。The IPermission returned by this method represents the same access to resources as the original WebPermission. 此方法将重写 Copy,并实现以支持 IPermission 接口。This method overrides Copy and is implemented to support the IPermission interface.

适用于