【发布时间】:2017-04-15 16:35:36
【问题描述】:
我有一个类型的类
public class One
{
public string firstString { get; set; }
public string secondString { get; set; }
}
还有 IEnumerable:
IEnumerable<One> firstIEnumerable;
在程序执行期间,我得到另一个 IEnumerable,
IEnumerable<string> secondIEnumerable = List<string>.Where(...);
我想要的是使用firstIEnumerable 的firstString 成员和来自secondIEnumerable 的任何值之间的相等性来请求firstIEnumerable 的secondString。
我想象一个这样的命令:
IEnumerable<string> thirdIEnumerable =
firstIEnumerable.Where(m=>m.firstString == secondIEnumerable.? ? ? ? ?).secondString;
但它不能编译。
【问题讨论】:
-
如果没有具体的例子,真的很难说出你想要达到的目标。请张贴minimal reproducible example,其中包含示例输入和您想要实现的输出。请记住,两者都是 sequences - 您是否尝试将 每个 项与另一个项进行匹配?
-
我已将问题编辑得更直接、更清晰。
标签: c# linq ienumerable