inkedmn
public text v1 · immutable public void LoadTasks()
{
DirectoryInfo d = new DirectoryInfo(this.libdir);
foreach (FileInfo f in d.GetFiles("*.dll"))
{
string fname = f.Name.Replace(f.Extension, "");
Assembly a = Assembly.LoadFile(fname);
Type[] types = a.GetTypes();
foreach (Type t in types)
{
if (this.ImplementsTaskInterface(t))
{
this.tasktemp.Add(t);
}
}
}
}
public bool ImplementsTaskInterface(Type t)
{
Type[] ifs = t.GetInterfaces();
return ((IList<Type>)ifs).Contains(typeof(IMonitorTask));
}