Your code should work. typeof(T).FullName excellent. This is a fully compiling, functioning program:
using System; class Program { public static string MyMethod<T>() { return typeof(T).FullName; } static void Main(string[] args) { Console.WriteLine(MyMethod<int>()); Console.ReadKey(); } }
Fulfillment of the above prints (as expected):
System.Int32
Reed Copsey Apr 05 '10 at 22:51 2010-04-05 22:51
source share