如何触发一个未知类型但知道事件名的事件
我需要在一个未知类型的object对象中出发已知事件名的事件怎么做呀?
public delegate void TestHandler();
class Program
{
static void Main(string[] args)
{
Program pr = new Program();
DataTest.eventTest += new TestHandler(pr.DataTest_eventTest);
DataTest dt=new DataTest();
DataPackage dp = new DataPackage();
dp.TriggeTest((object)dt,dt.GetType());
Console.ReadKey();
}
public void DataTest_eventTest()
{
Console.WriteLine( "test succeed ");
}
}
public class DataTest
{
public static event TestHandler eventTest;
}
public class DataPackage
{
private DataTest dt;