我想使用apple = theApples.trees.green
访问我的对象的值。
例如,如果我自己指定完整路径它是var colorOfApple = "red";
apple = theApples.trees.colorOfApple;
但我想这样做:
.colorOfApple
问题是它是否尝试访问对象的colorOfApple
但我希望值为{{1}}
答案 0 :(得分:2)
这很简单,只有this.results = this.results.OrderByDescending(x => x.WinPercentage).ThenByDescending(x => x.Goals);
var positionGroups = this.results.GroupBy(x => new { WinPercentage = x.WinPercentage, Goals = x.Goals });
int position = 1;
foreach (var positionGroup in positionGroups)
{
foreach (var team in positionGroup)
{
team.Position = position;
}
position++;
}