How to get the full type name?

has a class, can I get the full type name in the form of type A, B?

+5
source share
2 answers

Use AssemblyQualifiedNamein an instance of Type:

typeof(string).AssemblyQualifiedName

Or:

typeof(YourClass).AssemblyQualifiedName

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

+11
source

You can also use Type.FullName if you are not interested in assembly properties

Following your example:

typeof(A).FullName;

or from instance A:

anA.GetType().FullName;
+2
source

All Articles