【发布时间】:2015-01-22 11:56:30
【问题描述】:
我有一个像这样的简单对象:
public class Foo {
public int One { get; set; }
public int Two { get; set; }
....
public int Eleven { get; set; }
}
给定一个 IEnumerable,我想要一个 LINQ 方法来转换:
myFooEnumerable.Select(n => transformMagicGoesHere);
我的返回对象如下所示:
public class Bar {
public string DurationDescription {get;set;} //Value would be "One" or "Two" or ...
public int Value {get;set;} //Holds value in the property One or Two or ...
}
因此,对于上面示例中 myFooEnumerable 中的每个项目 N,我会在我的结果选择语句中获得 11(N) 个项目。
【问题讨论】: