类 class test1(object): def __init__(self): print "i am test1" class test2(object): def __init__(self): print "i am test2" # method 1 class_name = 'test1' eval(class_name)() # method 2 def exec_class(name): name() exec_class(test2) 函数 d
Imports System Imports System.Runtime.InteropServices Public Class DllInvoke Public Sub New(ByVal DLLPath As String) Me.hLib = DllInvoke.LoadLibrary(DLLPath) End Sub Protected Overrides Sub Finalize() Try DllInvoke.FreeLibrary(Me.hLib) Finally MyBase
C#动态webservice调用接口 1 using System; 2 using System.Collections; 3 using System.IO; 4 using System.Net; 5 using System.Text; 6 using System.Xml; 7 using System.Xml.Serialization; 8 namespace Hishop.Plugins 9 { 10 /// <summary> 11 /// 利用WebRequest/WebR
最近经常用到C#动态调用类库,简单的做下记录方便以后查询. 使用下面的几行代码就可以简单实现DLL类库的调用了 using System.Reflection; // 引入该命名空间 // 获取rocky.dll的文件路径 Assembly ass = Assembly.LoadFrom("./_lib/rocky.dll"); // 获取该dll中命名空间RockyNameSpace中Study类 Type type = ass.GetType("RockyNameSpac