Export (0) Print
Expand All

SocketPermission.Copy Method

Creates a copy of a SocketPermission instance.

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

Return Value

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

Implements

IPermission.Copy

Remarks

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.

Example

[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

[C#] 
// Creates a copy of the intersect SocketPermission.
     SocketPermission mySocketPermissionIntersectCopy = 
                               (SocketPermission)mySocketPermissionIntersect.Copy();

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


[C++] 
// 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.

Requirements

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

Show:
© 2014 Microsoft