日期:2014-05-17 浏览次数:20718 次
IGeneric IObj = (IGeneric)Assembly.Load("SocketMethod").CreateInstance("SocketMethod." + Msg.ToString());
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace SocketMethod
{
class Program
{
static void Main(string[] args)
{
// IGeneric IObj = (IGeneric)System.Reflection.Assembly.Load("SocketMethod").CreateInstance("SocketMethod." + Msg.ToString());
A a = new A();
if (a.Check("D1"))
Console.WriteLine("D1有事件");
else
Console.WriteLine("D1无事件");
if (a.Check("D2"))
Console.WriteLine("D2有事件");
else
Console.WriteLine("D2无事件");
}
}
public class A
{
public bool Check(string Msg)
{
IGeneric IObj = (IGeneric)System.Reflection.Assembly.Load("SocketMethod").CreateInstance("SocketMethod." + Msg.ToString());
System.Reflection.MemberInfo[] mis = IObj.GetType().GetMembers();
foreach (System.Reflection.MemberInfo mi in mis)
{
switch (mi.MemberType)
{
case System.Reflection.MemberTypes.Event:
//Console.WriteL