private static int GetTypeGenerity(Type type) { if (!type.ContainsGenericParameters) return 0; return type.GetGenericArguments().Length; }