assume you got XmlNode node referring to one of <Add> in the below after lookup (you can use anyway to store your configuration this is just an example, eg your hashtable way)
<EggFactory>
<Add Name="" Assembly="EasterEgg.dll" Type="YourNameSpace.Egg" />
<Add Name="Red" Assembly="EasterEgg.dll" Type="YourNameSpace.EggRed" />
<Add Name="Blue" Assembly="EasterEgg2.dll" Type="YourNameSpace.EggBlue" />
</EggFactory>
string asm = this.GetAssemblyFullName(node.Attributes["Assembly"].Value);
string type = node.Attributes["Type"].Value;
object obj = Assembly.LoadFile(asm).CreateInstance(
type, false, BindingFlags.CreateInstance, null, null,
CultureInfo.CurrentCulture, null);
EasterEgg egg = obj as EasterEgg;
return egg;
// Helper
private string GetAssemblyFullName(string assemblyValue)
{
string path = assemblyValue.Replace(@"\", "/");
if (path.IndexOf("/") == -1)
{
path = Environment.CurrentDirectory + "/" + path;
}
return path;
}
You should be able to figure out vb.net counterparts..hth.
blackinkbottle
"please polish my crude soul", to the maker of blade the Samurai kneed down and said.