SocketPermission.Copy 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
创建 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 接口。