Share via


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

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

반환

현재 사용 권한이 지정된 사용 권한의 하위 집합이면 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및 는 Z 가 아닌 null개체를 나타냅니다IPermission.

  • X. IsSubsetOf(X)는 를 반환합니다 true.

  • X. IsSubsetOf(Y)는 와 동일한 값을 Y반환합니다. IsSubsetOf(X) if and only if and if X and Y represent the same set of permissions.

  • 인 경우 X IsSubsetOf(Y) 및 .Y IsSubsetOf(Z)는 모두 , 을 X반환true합니다. IsSubsetOf(Z)는 를 반환합니다true.

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

적용 대상