开发者

How to get the full type name?

have a class, can I 开发者_运维知识库get the full type name in the form like A,B?


Use AssemblyQualifiedName on the Type instance:

typeof(string).AssemblyQualifiedName

Or:

typeof(YourClass).AssemblyQualifiedName

Also, if you have an instance of an object, and want to know the full type name from that; use GetType() to get the Type instance from the instance.


You can also use Type.FullName in case you're not interested in the assembly properties

Following your example:

typeof(A).FullName;

or from an instance of A:

anA.GetType().FullName;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜