WebPermission.Copy Metoda

Definicja

Tworzy kopię obiektu 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

Zwraca

IPermission

Nowe wystąpienie WebPermission klasy, które ma te same wartości co oryginalna.

Przykłady

W poniższym przykładzie pokazano, jak utworzyć drugie wystąpienie WebPermission programu przy użyciu polecenia Copy. To drugie wystąpienie jest identyczne z pierwszym.

// 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()

Uwagi

Zwrócony IPermission przez tę metodę reprezentuje ten sam dostęp do zasobów co oryginalny WebPermissionelement . Ta metoda zastępuje Copy i jest implementowana w celu obsługi interfejsu IPermission .

Dotyczy