Reputation: 196539
i have an object that is something like this with a full namespace.
MyDomainModel.Model.Application
i want to do something like this in a generic function so that it will just display "Application" (without the rest of the namepace
I need to do this in a function that passes in a generic so i tried to do this:
typeof(T).ToString()
but that didn't work. any thoughts?
Upvotes: 0
Views: 69
Reputation: 62037
typeof(T).Name
is what you are looking for.
The typeof
operator returns a Type
object, which offers lots of information on the type.
Upvotes: 7