Dar*_*rov 17
您可以返回一个匿名对象:
var result = SortedList.Select(x => new {
x.Value.MyProperty,
x.Value.AnotherProperty
});
Run Code Online (Sandbox Code Playgroud)
或者,如果要使用当前方法范围之外的结果,可以定义自定义类型:
IEnumerable<MyType> result = SortedList.Select(x => new MyType {
Prop1 = x.Value.MyProperty,
Prop2 = x.Value.AnotherProperty
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10458 次 |
| 最近记录: |