public static void Main()
        {
            ClassRequiringFullTrust iclass =
               new ClassRequiringFullTrust();
            Console.WriteLine(iclass.ToString());

            // You cannot create a type that inherits from the full trust type
            // directly, but you can create a type that inherits from
            // the APTCA type which in turn inherits from the full trust type.

            InheritFromAFullTrustDecendent inherit =
               new InheritFromAFullTrustDecendent();
            //Show the inherited protected member has changed.
            Console.WriteLine("From Test: {0}", inherit.ToString());

            // Trusted types now get the wrong information from
            // the TrustedLocation property.
            Console.WriteLine(iclass.ToString());
        }
        public static void Access()
        {
            // This security check fails if the caller
            // does not have full trust.
            NamedPermissionSet pset = new NamedPermissionSet("FullTrust");

            // This try-catch block shows the caller's permissions.
            // Correct code would either not catch the exception,
            // or would rethrow it.
            try
            {
                pset.Demand();
            }
            catch (SecurityException e)
            {
                Console.WriteLine("Demand for full trust:{0}", e.Message);
            }
            // Call the type that requires full trust.
            // Violates rule AptcaMethodsShouldOnlyCallAptcaMethods.
            ClassRequiringFullTrust.DoWork();
        }
 public static void Main()
 {
     // Indirectly calls DoWork in the full-trust class.
       ClassRequiringFullTrust testClass = new ClassRequiringFullTrust();
       testClass.Access();
 }