SocketPermission.Copy Method

Creates a copy of a SocketPermission instance.

Namespace: System.Net
Assembly: System (in system.dll)

virtual IPermission^ Copy () override
public IPermission Copy ()
public override function Copy () : IPermission
Not applicable.

Return Value

A new instance of the SocketPermission class that is a copy of the current instance.

The object returned by this method represents the same level of access as the current instance. This method overrides Copy and is implemented to support the IPermission interface.

The following example creates a SocketPermission by taking a copy of an existing 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");

Windows 98, Windows Server 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The Microsoft .NET Framework 3.0 is supported on Windows Vista, Microsoft Windows XP SP2, and Windows Server 2003 SP1.

.NET Framework

Supported in: 3.0, 2.0, 1.1, 1.0

Community Additions