Surprised this was so difficult, in the end I wrote this method, which seems to give the right answer.
public static class Extensions
{
public static Type GetVariableType<T>(this T instance)
{
return typeof(T);
}
}
Example usage:
void Main()
{
IList x = new List<int>{};
x.GetVariableType().Dump();
}
Prints System.Collections.IList