public TypeInfo GetItemType() { if (Wrapped.IsArray) { return(Wrapped.GetElementType() ?? throw new InvalidOperationException()); } var types = GetTypeHierarchy(Wrapped); if (types.Contains(typeof(IEnumerable <>))) { return(types .First(o => o.IsConstructedGenericType && o.GetGenericTypeDefinition() == typeof(IEnumerable <>)) .GenericTypeArguments[0]); } return(typeof(object)); }