gh9*_*gh9 -1 c# linq reflection
private string DoStuff(object result, StringBuilder returnBuilder)
{
// get a list of all public properties and order by name
// so we can guarentee that the order of the headers and
// the results are the same
foreach (var prop in result.GetType().GetProperties().OrderBy(x => x.Name))
{
// do something cool
}
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,如果没有OrderBy在for循环中我保证List的本机顺序将是在对象中声明属性的顺序
| 归档时间: |
|
| 查看次数: |
33 次 |
| 最近记录: |