Rediger

Del via


ReflectionPermission.Flags Property

Definition

Gets or sets the type of reflection allowed for the current permission.

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

Property Value

The set flags for the current permission.

Exceptions

An attempt is made to set this property to an invalid value. See ReflectionPermissionFlag for the valid values.

Examples

The following code example shows the use of the Flags property. This example is part of a larger example provided for the ReflectionPermission class.

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

Applies to