Get the fully qualified name of a class?

我怕爱的太早我们不能终老 提交于 2019-12-13 12:00:42

问题


All, I have a log4net implementation and I'm trying to use the AdoNetAppender, but one of the subelements for the appender configuration is connectionType and it requires a fully qualified class name like System.Data.SqlClient.SqlConnection, System.Data, Version=1.0.3300.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 (got that from the documentation as an example).

However, it can't load that one because this is a .NET4 MVC application. Can somebody tell me how I can get that fully qualified name so it will load the type and connect to the database? I've tried everything that I can honestly think of.


回答1:


I'm not sure what type you need, but you can use this in code to get the fully qualified name of a type.

string fullyQualifiedName = typeof(MyType).AssemblyQualifiedName;


来源:https://stackoverflow.com/questions/13204720/get-the-fully-qualified-name-of-a-class

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!