How can I get the type of the general parameter?
For instance:
void Example<T>() { // Here I want to get the type of T (and how can I get if T is a primitive // kind (int,bool,string) not class) }
Type type = typeof(T);
This will give you a type object for type T.
type.IsPrimitive will tell you if it is one of the primitive types, see here: http://msdn.microsoft.com/en-us/library/system.type.isprimitive.aspx
type.IsPrimitive
Also note that although string is a basic type that is very integrated with the .NET system, it is not primitive. System.String is a full-fledged class, not a primitive.
string
System.String
use to get type T:
Type typeParameterType = typeof(T);
typeof (link to C #)
You can also get type T from an instance of type T:
instance.GetType();