다음을 통해 공유


ReflectionPermission.Flags 속성

현재 권한에 사용할 수 있는 리플렉션 형식을 가져오거나 설정합니다.

네임스페이스: System.Security.Permissions
어셈블리: mscorlib(mscorlib.dll)

구문

‘선언
Public Property Flags As ReflectionPermissionFlag
‘사용 방법
Dim instance As ReflectionPermission
Dim value As ReflectionPermissionFlag

value = instance.Flags

instance.Flags = value
public ReflectionPermissionFlag Flags { get; set; }
public:
property ReflectionPermissionFlag Flags {
    ReflectionPermissionFlag get ();
    void set (ReflectionPermissionFlag value);
}
/** @property */
public ReflectionPermissionFlag get_Flags ()

/** @property */
public void set_Flags (ReflectionPermissionFlag value)
public function get Flags () : ReflectionPermissionFlag

public function set Flags (value : ReflectionPermissionFlag)

속성 값

현재 권한에 대한 설정 플래그입니다.

예외

예외 형식 조건

ArgumentException

이 속성을 잘못된 값으로 설정하려고 시도한 경우. 올바른 값을 보려면 ReflectionPermissionFlag를 참조하십시오.

예제

    Private Function IsSubsetOfDemo() As Boolean
        Dim returnValue As Boolean = True
        Dim reflection1, reflection2 As ReflectionPermissionFlag
        Dim reflectionPerm1, reflectionPerm2 As ReflectionPermission
        Dim reflectionGen1 As New ReflectionGenerator()
        Dim reflectionGen2 As New ReflectionGenerator()
        reflectionGen1.ResetIndex()
        While reflectionGen1.CreateReflection(reflection1)
            reflectionPerm1 = New ReflectionPermission(reflection1)
            reflectionGen2.ResetIndex()
            Console.WriteLine("********************************************************" & ControlChars.Lf)
            While reflectionGen2.CreateReflection(reflection2)
                reflectionPerm2 = New ReflectionPermission(reflection2)
                Try
                    If reflectionPerm1.IsSubsetOf(reflectionPerm2) Then
                        Console.WriteLine((reflectionPerm1.Flags.ToString() & " is a subset of " _
                        & reflectionPerm2.Flags.ToString()))
                    Else
                        Console.WriteLine((reflectionPerm1.Flags.ToString() & " is not a subset of " _
                        & reflectionPerm2.Flags.ToString()))
                    End If
                Catch e As Exception
                    Console.WriteLine(("An exception was thrown for subset :" & reflectionPerm1.ToString() _
                    & ControlChars.Lf & reflectionPerm2.ToString() & ControlChars.Lf & e.ToString()))
                    returnValue = False
                End Try
ContinueWhile2:
            End While
ContinueWhile1:
        End While
        Return returnValue
    End Function 'IsSubsetOfDemo
private bool IsSubsetOfDemo()
{
    bool returnValue = true;
    ReflectionPermissionFlag reflection1, reflection2;
    ReflectionPermission reflectionPerm1, reflectionPerm2;
    ReflectionGenerator reflectionGen1 = new ReflectionGenerator();
    ReflectionGenerator reflectionGen2 = new ReflectionGenerator();
    reflectionGen1.ResetIndex();
    while (reflectionGen1.CreateReflection(out reflection1))
    {
        reflectionPerm1 = new ReflectionPermission(reflection1);
        reflectionGen2.ResetIndex();
        Console.WriteLine("********************************************************\n");

        while (reflectionGen2.CreateReflection(out reflection2))
        {
            reflectionPerm2 = new ReflectionPermission(reflection2);
            try
            {
                if (reflectionPerm1.IsSubsetOf(reflectionPerm2))
                {
                    Console.WriteLine(reflectionPerm1.Flags + " is a subset of " +
                        reflectionPerm2.Flags);
                }
                else
                {
                    Console.WriteLine(reflectionPerm1.Flags + " is not a subset of " +
                        reflectionPerm2.Flags);
                }
            }
            catch (Exception e)
            {
                Console.WriteLine("An exception was thrown for subset :" + reflectionPerm1 + "\n" +
                    reflectionPerm2 + "\n" + e);
                returnValue = false;
            }
        }
    }
    return returnValue;
}
bool IsSubsetOfDemo()
{
   bool returnValue = true;
   ReflectionPermissionFlag reflection1;
   ReflectionPermissionFlag reflection2;
   ReflectionPermission^ reflectionPerm1;
   ReflectionPermission^ reflectionPerm2;
   ReflectionGenerator^ reflectionGen1 = gcnew ReflectionGenerator;
   ReflectionGenerator^ reflectionGen2 = gcnew ReflectionGenerator;
   reflectionGen1->ResetIndex();
   while ( reflectionGen1->CreateReflection(  &reflection1 ) )
   {
      reflectionPerm1 = gcnew ReflectionPermission( reflection1 );
      reflectionGen2->ResetIndex();
      Console::WriteLine( "********************************************************\n" );
      while ( reflectionGen2->CreateReflection(  &reflection2 ) )
      {
         reflectionPerm2 = gcnew ReflectionPermission( reflection2 );  
         try
         {
            if ( reflectionPerm1->IsSubsetOf( reflectionPerm2 ) )
            {
               Console::WriteLine( "{0} is a subset of {1}", reflectionPerm1->Flags, reflectionPerm2->Flags );
            }
            else
            {
               Console::WriteLine( "{0} is not a subset of {1}", reflectionPerm1->Flags, reflectionPerm2->Flags );
            }
         }
         catch ( Exception^ e ) 
         {
            Console::WriteLine( "An exception was thrown for subset : {0}\n{1}\n{2}", reflectionPerm1, reflectionPerm2, e );
            returnValue = false;
         }

      }
   }

   return returnValue;
}
private boolean IsSubsetOfDemo() 
{
    boolean returnValue = true;
    ReflectionPermissionFlag reflection1[] = 
        new ReflectionPermissionFlag[1] ;
    ReflectionPermissionFlag reflection2[] = 
        new ReflectionPermissionFlag[1] ;
    ReflectionPermission reflectionPerm1[] = 
        new ReflectionPermission[1] ;
    ReflectionPermission reflectionPerm2[] = 
        new ReflectionPermission[1];
    ReflectionGenerator reflectionGen1 =  
        new ReflectionGenerator();
    ReflectionGenerator reflectionGen2 =  
        new ReflectionGenerator();
    reflectionGen1.ResetIndex();
    while(reflectionGen1.CreateReflection(reflectionPerm1, reflection1)) {
        if (reflectionPerm1[0] == null) {
            continue ;
        }
        reflectionGen2.ResetIndex();
        Console.WriteLine("***************************************" 
            + "*****************\n");
        
        while(reflectionGen2.CreateReflection(
            reflectionPerm2, reflection2)) {
            if (reflectionPerm2[0] == null) {
                continue ;
            }
            try {
                if ( reflectionPerm1[0].IsSubsetOf(reflectionPerm2[0])) {
                    Console.WriteLine((reflectionPerm1[0].get_Flags() 
                        + " is a subset of " + 
                    reflectionPerm2[0].get_Flags()));
                }
                else {
                    Console.WriteLine((reflectionPerm1[0].get_Flags() 
                        + " is not a subset of " 
                        + reflectionPerm2[0].get_Flags()));
                }
            }
            catch(System.Exception e) {
                Console.WriteLine(("An exception was " 
                    + "thrown for subset :" + reflectionPerm1[0] + "\n" 
                    + reflectionPerm2[0] + "\n" + e));
                returnValue = false;
            }
        }
    }
    return returnValue ;
} //IsSubsetOfDemo

플랫폼

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

.NET Framework에서 모든 플래폼의 모든 버전을 지원하지는 않습니다. 지원되는 버전의 목록은 시스템 요구 사항을 참조하십시오.

버전 정보

.NET Framework

2.0, 1.1, 1.0에서 지원

참고 항목

참조

ReflectionPermission 클래스
ReflectionPermission 멤버
System.Security.Permissions 네임스페이스