This documentation is archived and is not being maintained.

SocketPermission.Copy Method

Creates a copy of a SocketPermission instance.

[Visual Basic]
Overrides Public Function Copy() As IPermission Implements _
public override IPermission Copy();
public: IPermission* Copy();
public override function Copy() : IPermission;

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.


[Visual Basic, C#, C++] The following example creates a SocketPermission by taking a copy of an existing SocketPermission.

[Visual Basic] 
' 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 = 

     if (mySocketPermissionIntersectCopy.Equals(mySocketPermissionIntersect)){
     Console.WriteLine("Copy successfull");

// Creates a copy of the intersect SocketPermission.
SocketPermission *mySocketPermissionIntersectCopy = 
    __try_cast<SocketPermission *>(mySocketPermissionIntersect->Copy());

if (mySocketPermissionIntersectCopy->Equals(mySocketPermissionIntersect)){
    Console::WriteLine("Copy successfull");

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

SocketPermission Class | SocketPermission Members | System.Net Namespace