C# Type IsSecurityCritical
Description
Type IsSecurityCritical
gets a value that indicates
whether the current type is security-critical or security-safe-critical
at the current trust level, and therefore can perform critical operations.
Syntax
Type.IsSecurityCritical
has the following syntax.
public virtual bool IsSecurityCritical { get; }
Example
// w w w .j a v a 2 s . c o m
using System;
namespace SystemType
{
public class MyClass
{
sealed public class MyTestClass
{
}
public static void Main(string []args)
{
try
{
bool myBool = false;
MyTestClass myTestClassInstance = new MyTestClass();
Type myType = myTestClassInstance.GetType();
Console.WriteLine(myType.IsSecurityCritical);
}
catch (Exception e)
{
Console.WriteLine("\nAn exception occurred: {0}",e.Message);
}
}
}
}
The code above generates the following result.