Copy Method
Collapse the table of content
Expand the table of content
This documentation is archived and is not being maintained.

SocketPermission.Copy Method

Creates a copy of a SocketPermission instance.

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

Public Overrides Function Copy As IPermission
Dim instance As SocketPermission
Dim returnValue As IPermission

returnValue = instance.Copy
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.
Dim mySocketPermissionIntersectCopy As SocketPermission = CType(mySocketPermissionIntersect.Copy(), SocketPermission)

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

// 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
© 2016 Microsoft