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 接口。

适用于