cdfllc
asked on
Create Instance of an Interface
I thought this would be easy :) And it probably is, but I've searched and can't find anything...
Isn't there an equivalent for "getClassForName" from Java?
I have an interface, but don't know what specific class I want to load until runtime. Sure you've heard this before. I want to grab the string of the name from the Web.config file and dynamically create a class of that type...
For example,
public static IServiceProvider GetServiceProvider()
{
if (serviceProvider == null)
{
String ServiceProviderObjectName = GlobalConfigurations.Servi ceProvider Type;
serviceProvider = (IServiceProvider)Activato r.CreateIn stance(nul l,ServiceP roviderObj ectName );
}
return serviceProvider ;
}
What am I missing? And if it's all that stuff about assemblies, etc. Could someone give me the 2 minute drill on what that stuff is...:)
Thanks!
cdfllc
Isn't there an equivalent for "getClassForName" from Java?
I have an interface, but don't know what specific class I want to load until runtime. Sure you've heard this before. I want to grab the string of the name from the Web.config file and dynamically create a class of that type...
For example,
public static IServiceProvider GetServiceProvider()
{
if (serviceProvider == null)
{
String ServiceProviderObjectName = GlobalConfigurations.Servi
serviceProvider = (IServiceProvider)Activato
}
return serviceProvider ;
}
What am I missing? And if it's all that stuff about assemblies, etc. Could someone give me the 2 minute drill on what that stuff is...:)
Thanks!
cdfllc
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER