【发布时间】:2011-02-10 23:59:22
【问题描述】:
我正在尝试根据设置动态加载我的身份验证服务器类型。当我不知道类型时,我很想知道如何转换为类型。
Type t = Type.GetType(WebConfigurationManager.AppSettings.Get("AuthenticationSvcImpl"));
IAuthenticationService authCli = Activator.CreateInstance(t);
return authCli.AuthenticateUser(login);
我知道有 Convert.ChangeType(),但它只是转换为一个对象...
【问题讨论】:
标签: c# reflection interface casting