Use the is
keyword and reflection.
public bool IsList(object o)
{
if(o == null) return false;
return o is IList &&
o.GetType().IsGenericType &&
o.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(List<>));
}
public bool IsDictionary(object o)
{
if(o == null) return false;
return o is IDictionary &&
o.GetType().IsGenericType &&
o.GetType().GetGenericTypeDefinition().IsAssignableFrom(typeof(Dictionary<,>));
}