我有一个 IEnumerable 类型的对象 result 和一个 Object 类型的对象 res。 我想连接两者,我该怎么做
IEnumerable<V_Student_Attendace_DayWise> result;
V_Student_Attendace_DayWise res;
result.Concat(res); // Error here...
最佳答案
Enumerable.Concat
方法需要一个集合作为它的参数,因此您必须将输入作为一个集合来进行连接。因此,此代码如下所示,其中 res
您已经拥有的对象
result = result.Concat(new[] { res});
你也可以试试这个:
result = result.Concat(new[] { new V_Student_Attendace_DayWise()});
关于c# - 如何向 IEnumerable 添加一行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41032484/