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;
精彩评论