【发布时间】:2014-09-05 06:30:10
【问题描述】:
这两种方法我都试过了,但没有用?该怎么做?
.SelectMany(x => x.SectionEvents).SelectMany(t => t.Section)
.SelectMany(x => x.SectionEvents.SelectMany(t => t.Section))
错误:
方法的类型参数 '
System.Linq.Enumerable.SelectMany<TSource,TResult>(System.Collections.Generic.IEnumerable<TSource>, System.Func<TSource,System.Collections.Generic.IEnumerable<TResult>>)' 不能从用法推断。尝试指定类型参数 明确的。
EEvent.List<EEvent>("CalendarPeriodUId", ECalendarPeriod.Current().UId).Value.ToList()
.SelectMany(x => x.SectionEvents.SelectMany(t => t.Section)).ToFCollection().Bind(ddlSection, "SectionName");
【问题讨论】:
-
编译器告诉你该做什么。
-
请举一个简短但完整的例子。我不希望您必须指定类型参数。
-
这个例子适合你吗,@Jon Skeet?
-
我认为我们需要查看数据类型 EEvent。即了解 x 在您的初始帖子中的结构以及 x.SectionEvents 是什么
-
并非如此 - 这远不是一个简短但完整的示例来说明问题,不是吗?特别是我无法复制、粘贴、编译和查看问题。如果你提供了一个很好的例子,那么没有人需要猜测......