ms-help://MS.VSCC/MS.MSDNVS.2052/cpguide/html/cpcondynamicallyloadingusingtypes.htm

解决方案 »

  1.   

    System.Assembly.Load("YourDllName")然后怎么声明对象?
      

  2.   

    [DllImport("kernel32")]
    private static extern int GetPrivateProfileString(string section,
    string key,string def, StringBuilder retVal,
    int size,string filepath);
      

  3.   

    System.Assembly.Load("YourDllName")然后怎么声明对象?
    同意
      

  4.   

    System.Reflection.Assembly.Load("YourDllName").CreateInstance("Your Class")
      

  5.   

    System.Reflection.Assembly.Load("YourDllName").CreateInstance("Your Class")
    对象怎样实例化?能不能给个完整的例子
      

  6.   

    http://www.csdn.net/develop/article/19/19284.shtm
      

  7.   

    http://www.microsoft.com/china/msdn/library/dnadvnet/html/vbnet10082002.asp
      

  8.   

    // LoadInvoke loads MyAssembly.dll and invokes the MyMethod1 method. 
    // After compiling this class, run LoadInvoke.exe with MyAssembly.dll 
    // as the command line argument, as shown below:
    // LoadInvoke Myassembly.dllusing System;
    using System.Reflection;
    public class LoadInvoke
    {
        public static void Main(string[] args)
        {
            Assembly a = Assembly.LoadFrom(args[0]);
            Type[] mytypes = a.GetTypes();
            BindingFlags flags = (BindingFlags.NonPublic | BindingFlags.Public | 
                BindingFlags.Static | BindingFlags.Instance | BindingFlags.DeclaredOnly);        foreach(Type t in mytypes)
            {
                MethodInfo[] mi = t.GetMethods(flags);
                Object obj = Activator.CreateInstance(t);            foreach(MethodInfo m in mi)
                {
                    m.Invoke(obj, null);
                }
            }
        }
    }