mark ReflectionPermission : ReflectionPermission « System.Security.Permissions « C# / C Sharp by API






mark ReflectionPermission

  
using System;
using System.Collections.Generic;
using System.IO;
using System.IO.IsolatedStorage;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Security;
using System.Security.AccessControl;
using System.Security.Policy;
using System.Security.Permissions;
using System.Security.Principal;
using System.Text;

public class MainClass
{
    public static void Main()
    {
        object x = InvokePrivately("Hello", "IsAscii");
        Console.WriteLine(x);
    }
    [ReflectionPermission(SecurityAction.LinkDemand)]
    private static object InvokePrivately(object o, string m)
    {
        return o.GetType().InvokeMember(m,
            BindingFlags.NonPublic|BindingFlags.Instance|BindingFlags.InvokeMethod,
            null, o, new object[0]);
    }
}

   
    
  








Related examples in the same category