共用方式為


SocketPermission.Copy 方法

定義

建立 SocketPermission 執行個體的複本。

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

傳回

SocketPermission 類別的新執行個體,是目前執行個體的複本。

範例

下列範例會 SocketPermission 藉由取得現有 SocketPermission的複本來建立 。

// Creates a copy of the intersect SocketPermission.
SocketPermission^ mySocketPermissionIntersectCopy =
   (SocketPermission^)( mySocketPermissionIntersect->Copy() );
if ( mySocketPermissionIntersectCopy->Equals( mySocketPermissionIntersect ) )
{
   Console::WriteLine(  "Copy successfull" );
}
// Creates a copy of the intersect SocketPermission.
     SocketPermission mySocketPermissionIntersectCopy =
                               (SocketPermission)mySocketPermissionIntersect.Copy();

     if (mySocketPermissionIntersectCopy.Equals(mySocketPermissionIntersect)){
     Console.WriteLine("Copy successfull");
     }
' Creates a copy of the intersect SocketPermission.
Dim mySocketPermissionIntersectCopy As SocketPermission = CType(mySocketPermissionIntersect.Copy(), SocketPermission)

If mySocketPermissionIntersectCopy.Equals(mySocketPermissionIntersect) Then
   Console.WriteLine("Copy successfull")
End If

備註

這個方法所傳回的物件代表與目前實例相同的存取層級。 這個方法會 Copy 覆寫 並實作以支援 IPermission 介面。

適用於