다음을 통해 공유


NetworkInformationPermission.Intersect(IPermission) 메서드

정의

현재 사용 권한 및 지정된 사용 권한의 공통 권한을 만들어 반환합니다.

public:
 override System::Security::IPermission ^ Intersect(System::Security::IPermission ^ target);
public override System.Security.IPermission Intersect (System.Security.IPermission target);
override this.Intersect : System.Security.IPermission -> System.Security.IPermission
Public Overrides Function Intersect (target As IPermission) As IPermission

매개 변수

target
IPermission

현재 사용 권한과 공통되는 요소를 추출할 IPermission입니다. 현재 사용 권한과 동일한 형식이어야 합니다.

반환

현재 사용 권한과 지정된 사용 권한의 교집합을 나타내는 NetworkInformationPermission입니다. 교집합이 비어 있거나 targetnull이면 새 사용 권한은 null입니다.

예외

target이(가) NetworkInformationPermission가 아닌 경우

예제

다음 예제에서는 기존 사용 권한 개체의 교집합인 권한 개체를 만듭니다.

System::Net::NetworkInformation::NetworkInformationPermission^ unrestricted = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Security::Permissions::PermissionState::Unrestricted );

Console::WriteLine( L"Is unrestricted? {0}", unrestricted->IsUnrestricted() );

System::Net::NetworkInformation::NetworkInformationPermission^ read = gcnew System::Net::NetworkInformation::NetworkInformationPermission( System::Net::NetworkInformation::NetworkInformationAccess::Read );

System::Net::NetworkInformation::NetworkInformationPermission^ copyPermission = dynamic_cast<System::Net::NetworkInformation::NetworkInformationPermission^>(read->Copy());

System::Net::NetworkInformation::NetworkInformationPermission^ unionPermission = dynamic_cast<System::Net::NetworkInformation::NetworkInformationPermission^>(read->Union( unrestricted ));
Console::WriteLine( L"Is subset?{0}", read->IsSubsetOf( unionPermission ) );

System::Net::NetworkInformation::NetworkInformationPermission^ intersectPermission = dynamic_cast<System::Net::NetworkInformation::NetworkInformationPermission^>(read->Intersect( unrestricted ));
System.Net.NetworkInformation.NetworkInformationPermission unrestricted =
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Security.Permissions.PermissionState.Unrestricted);

Console.WriteLine("Is unrestricted? " + unrestricted.IsUnrestricted());

System.Net.NetworkInformation.NetworkInformationPermission read =
    new System.Net.NetworkInformation.NetworkInformationPermission(
        System.Net.NetworkInformation.NetworkInformationAccess.Read);
System.Net.NetworkInformation.NetworkInformationPermission copyPermission =
   (System.Net.NetworkInformation.NetworkInformationPermission) read.Copy();
System.Net.NetworkInformation.NetworkInformationPermission unionPermission =
   (System.Net.NetworkInformation.NetworkInformationPermission) read.Union(unrestricted);
Console.WriteLine("Is subset?" + read.IsSubsetOf(unionPermission));
System.Net.NetworkInformation.NetworkInformationPermission intersectPermission =
   (System.Net.NetworkInformation.NetworkInformationPermission) read.Intersect(unrestricted);
Dim unrestricted As New System.Net.NetworkInformation.NetworkInformationPermission( _
    System.Security.Permissions.PermissionState.Unrestricted)
Console.WriteLine("Is unrestricted? " + unrestricted.IsUnrestricted().ToString())
Dim read As New System.Net.NetworkInformation.NetworkInformationPermission( _ 
    System.Net.NetworkInformation.NetworkInformationAccess.Read)
Dim copyPermission As System.Net.NetworkInformation.NetworkInformationPermission = _
    CType(read.Copy(), System.Net.NetworkInformation.NetworkInformationPermission)
Dim unionPermission As System.Net.NetworkInformation.NetworkInformationPermission = _
    CType(read.Union(unrestricted), System.Net.NetworkInformation.NetworkInformationPermission)
Console.WriteLine("Is subset?" + read.IsSubsetOf(unionPermission).ToString())
Dim intersectPermission As System.Net.NetworkInformation.NetworkInformationPermission = _ 
    CType(read.Intersect(unrestricted), _ 
          System.Net.NetworkInformation.NetworkInformationPermission)

설명

두 권한의 교차점은 둘 다 공통적으로 설명하는 상태를 설명하는 권한입니다. 두 원래 사용 권한을 모두 전달하는 요청만 교집합을 통과합니다.

적용 대상