共用方式為


ReflectionPermission.Flags 屬性

定義

取得或設定目前權限允許的反映類型。

public:
 property System::Security::Permissions::ReflectionPermissionFlag Flags { System::Security::Permissions::ReflectionPermissionFlag get(); void set(System::Security::Permissions::ReflectionPermissionFlag value); };
public System.Security.Permissions.ReflectionPermissionFlag Flags { get; set; }
member this.Flags : System.Security.Permissions.ReflectionPermissionFlag with get, set
Public Property Flags As ReflectionPermissionFlag

屬性值

目前權限的設定旗標。

例外狀況

嘗試將這個屬性設定為無效的值。 如需有效值,請參閱 ReflectionPermissionFlag

範例

下列程式代碼範例顯示 屬性的使用 Flags 。 此範例是針對 類別提供的較大範例的 ReflectionPermission 一部分。

private static void IsSubsetOfDemo()
{
    ReflectionPermission memberAccessPerm = new ReflectionPermission(ReflectionPermissionFlag.MemberAccess);
    ReflectionPermission restrictedMemberAccessPerm = new ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess);

    if (restrictedMemberAccessPerm.IsSubsetOf(memberAccessPerm))
    {
        Console.WriteLine(restrictedMemberAccessPerm.Flags + " is a subset of " +
            memberAccessPerm.Flags);
    }
    else
    {
        Console.WriteLine(restrictedMemberAccessPerm.Flags + " is not a subset of " +
            memberAccessPerm.Flags);
    }
}
Private Shared Sub IsSubsetOfDemo()

    Dim memberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.MemberAccess)
    Dim restrictedMemberAccessPerm As New ReflectionPermission(ReflectionPermissionFlag.RestrictedMemberAccess)
    If restrictedMemberAccessPerm.IsSubsetOf(memberAccessPerm) Then
        Console.WriteLine(restrictedMemberAccessPerm.Flags + " is a subset of " + memberAccessPerm.Flags)
    Else
        Console.WriteLine(restrictedMemberAccessPerm.Flags.ToString() + _
        " is not a subset of " + memberAccessPerm.Flags.ToString())
    End If

End Sub

適用於