简体   繁体   English

C#将2个列表绑定到转发器

[英]c# bind 2 lists to repeater

[c# linq] [C#LINQ]

i have 2 datasources, 1 coming from an xml document and 1 coming from an sql server database, both return an IEnumerable<EventsDetails> is it possible to bind both of these lists to a single repeater? 我有2个数据源,1个来自xml文档,1个来自sql服务器数据库,都返回IEnumerable<EventsDetails> ,是否可以将这两个列表都绑定到单个转发器?

You're probably looking for something like this, if you want to use LINQ: 如果要使用LINQ,您可能正在寻找类似的东西:

var both= list1.Union(list2);

Then both is your data source. 然后both都是您的数据源。

Create a new list containing both. 创建一个包含两者的新列表。 Or an object implementing IEnumetator which first returns elements from the first, then from the second list. 或实现IEnumetator的对象,该对象首先从第一个列表中返回元素,然后从第二个列表中返回元素。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM