How can I get the namespace from a generic type?

c#, generics, namespaces

Solution

You can use `typeof(T).FullName`.

That string contains both the class name and the namespace.

Problem

I have a method that I specify to be of a certain type. E.g. ``` public MyLabels GetLabels<T>() { // I'd like to get the namespace of the type that T represents here } ``` How can I do this?

Original source