IPermission.IsSubsetOf(IPermission) 메서드

정의

현재 사용 권한이 지정된 사용 권한의 하위 집합인지를 확인합니다.

public:
 bool IsSubsetOf(System::Security::IPermission ^ target);
public bool IsSubsetOf (System.Security.IPermission target);
public bool IsSubsetOf (System.Security.IPermission? target);
abstract member IsSubsetOf : System.Security.IPermission -> bool
Public Function IsSubsetOf (target As IPermission) As Boolean

매개 변수

target
IPermission

하위 집합 관계를 테스트할 사용 권한입니다. 이 사용 권한은 현재 사용 권한과 형식이 같아야 합니다.

반환

Boolean

현재 사용 권한이 지정된 사용 권한의 하위 집합이면 true이고, 그렇지 않으면 false입니다.

예외

target 매개 변수가 null이 아니고 현재 사용 권한과 형식이 다른 경우

예제

다음 코드 예제에서는 메서드 구현을 IsSubsetOf 보여 줍니다. 이 코드 예제는에 대해 제공 된 큰 예제의 일부는 IPermission 클래스입니다.

    // Called by the Demand method: returns true 
    // if 'this' is a subset of 'target'.
public:
    virtual bool IsSubsetOf(IPermission^ target) override
    {
        // If 'target' is null and this permission allows nothing, 
        // return true.
        if (target == nullptr)
        {
            return (int)stateFlags == 0;
        }

        // Both objects must be the same type.
        SoundPermission^ soundPerm = VerifyTypeMatch(target);

        // Return true if the permissions of 'this' 
        // is a subset of 'target'.
        return stateFlags <= soundPerm->stateFlags;
    }
// Called by the Demand method: returns true if 'this' is a subset of 'target'.
public override Boolean IsSubsetOf(IPermission target)
{
    // If 'target' is null and this permission allows nothing, return true.
    if (target == null) return m_flags == 0;

    // Both objects must be the same type.
    SoundPermission soundPerm = VerifyTypeMatch(target);

    // Return true if the permissions of 'this' is a subset of 'target'.
    return m_flags <= soundPerm.m_flags;
}
' Called by the Demand method: returns true if 'this' is a subset of 'target'.
Public Overrides Function IsSubsetOf(ByVal target As IPermission) As [Boolean]
    ' If 'target' is null and this permission allows nothing, return true.
    If target Is Nothing Then
        Return m_flags = 0
    End If
    ' Both objects must be the same type.
    Dim soundPerm As SoundPermission = VerifyTypeMatch(target)

    ' Return true if the permissions of 'this' is a subset of 'target'.
    Return m_flags <= soundPerm.m_flags

End Function 'IsSubsetOf

설명

현재 권한 현재 사용 권한과 지정 된 권한으로 완전히 포함 된 작업의 집합을 지정 하는 경우 지정 된 사용 권한의 하위 집합입니다. 예를 들어 c:\example.txt 있는 사용 권한을 c: \에 대 한 액세스를 나타내는 사용 권한의 하위 집합인\합니다. 이 메서드가 반환 하는 경우 true, 현재 사용 권한과 액세스 권한을 보호 되는 리소스의 지정한 사용 권한에 보다를 나타냅니다.

다음 문은 메서드의 IsSubsetOf 모든 구현에 대해 true여야 합니다. X, Y및 그렇지 않은 null개체를 나타냅니다 IPermission Z.

  • X. IsSubsetOf(X)는 .true

  • X. IsSubsetOf(Y)는 .와 동일한 값을 Y반환합니다. 동일한 사용 권한 집합을 나타내는 경우에만 X Y IsSubsetOf(X)입니다.

  • If X. IsSubsetOf(Y) 및 Y. IsSubsetOf(Z)는 둘 다 반환합니다X.true IsSubsetOf(Z)는 .true

사용 권한 상태가 있는 빈 IPermission 개체를 나타내고 Y 개체를 IPermission 나타내는 경우 X .null``XNone IsSubsetOf(Y)는 .true 빈 권한인 경우 Z 복합 집합 작업 X입니다. Union(Z). 두 개의 빈 사용 권한의 합집합이 빈 사용 권한이므로 IsSubsetOf(Y)도 반환 true 됩니다.

적용 대상