tags:

views:

39

answers:

2

My method looks like:

public string DoObjectProperties<T>(T obj, string text)
{

}

Now from within the method, I need to get the string value of the class name that i pass into the method's 'obj' parameter.

So if I pass in the User object, I need the text 'user'.

To get the properties I am using: typeof(T).GetProperties()

How can I get the classes name?

+5  A: 

Just use .Name like this:

typeof(T).Name

This gives for example "String", there's also .FullName which would give "System.String"

Nick Craver
+2  A: 

typeof(T).Name?

mnemosyn