简体   繁体   中英

Get the fully qualified name of a class?

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.

我不确定您需要什么类型,但您可以在代码中使用它来获取类型的完全限定名称。

string fullyQualifiedName = typeof(MyType).AssemblyQualifiedName;

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM