当前位置: 动力学知识库 > 问答 > 编程问答 >

c# - 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.

网友答案:

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;
分享给朋友:
您可能感兴趣的文章:
随机阅读: