Edit: I made a mistake an the premise was wrong. typeof(T).IsClass does indeed work - as does typeof(T)IsInterface, as was pointed out.
Say I have this method:
public T GetService<T>() where T : IService
I think you can check runtime like below.
Please check this link for more details.