C#收益率返回列表,不是单个对象

时间:2018-10-12 14:00:41

标签: c# yield-return

我需要批处理子列表来批量处理对象。 Parallel.ForEach不可行,因为该批次已发布到HTTP请求。

const app = new Vue({
  el: '#app',
  data: {
    name: ''
  },
  mounted() {
        if (localStorage.name) {
      this.name = localStorage.name;
    }
  },
  watch: {
    name(newName) {
      localStorage.name = newName;
    }
  }
});

错误CS0029无法将类型'System.Collections.Generic.List'隐式转换为'T'。

期待“收益回报”以返回对象列表,而不是返回单个对象。

1 个答案:

答案 0 :(得分:0)

您的方法签名应为

public IEnumerable<IEnumerable<T>> BatchProcess<T>(IEnumerable<T> list, int batchSize)