static Type GetItemType(Type valueType) { if (valueType.IsArray) { return valueType.GetElementType(); } return valueType.GetGenericArguments()[0]; }