This documentation is archived and is not being maintained.

ReflectionPermission Constructor (ReflectionPermissionFlag)

Initializes a new instance of the ReflectionPermission class with the specified access.

Namespace: System.Security.Permissions
Assembly: mscorlib (in mscorlib.dll)

public ReflectionPermission (
	ReflectionPermissionFlag flag
)
public ReflectionPermission (
	ReflectionPermissionFlag flag
)
public function ReflectionPermission (
	flag : ReflectionPermissionFlag
)

Parameters

flag

One of the ReflectionPermissionFlag values.

Exception typeCondition

ArgumentException

The flag parameter is not a valid value of ReflectionPermissionFlag.

public bool CreateReflection(out ReflectionPermissionFlag reflection)
{

    if (reflectionIndex >= myReflection.Length)
    {

        reflection = ReflectionPermissionFlag.NoFlags;
        reflectionIndex++;
        return false;
    }
    reflection = myReflection[reflectionIndex++];
    return true;
}

public boolean CreateReflection(ReflectionPermission reflectionPerm[],
    ReflectionPermissionFlag reflection[]) 
{
    if (reflectionIndex >= myReflection.length) {
        reflectionPerm[0] = new ReflectionPermission(PermissionState.None);

        reflection[0] = ReflectionPermissionFlag.NoFlags;
        reflectionIndex++;
        return false ;
    }
    reflection[0] = myReflection[reflectionIndex ++];
    try {
        reflectionPerm[0] = new ReflectionPermission(reflection[0]);
        return true ;
    }
    catch(System.Exception  e){
        Console.WriteLine(("Cannot create ReflectionPermission: " 
            + reflection[0] + " " + e));
        reflectionPerm[0] = new ReflectionPermission(PermissionState.None);
        reflection[0] = ReflectionPermissionFlag.NoFlags;
        return true ;
    }
} //CreateReflection

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

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0
Show: