sorting - C# Sort List by multiple conditions -
I need to sort out some football standings My problem is how to sort in the correct order.
Sort:
- Points DESC
- Estimate Match
- Goal Difference DESC
- Target < Goal with input: TeamName - Issue - Scale Goals - TargetAgainst
- Team 3 - 1 - 2 - 10
- Team 4 - 8 - 12 - 5
- Team 5 - 5 - 7 - 4
... Match # 4 - Team 5 - Team 2 - 1-2
Match # 7 - Team 1 - Team 3 - 3-3 ...
Output: TeamName - Issue - Scale Goals - TargetAgnesestest
Because team 2 survives on Team 5, they end up in second place.
Because Team 1 Draws Team 3, they finish at 4. With a better goal difference
set up the public square permanent {public team team}; } Public int? Match played {received; Set; } Public int? Goal set; } Public int? GoalAugainst {Get; Set; } Public int? Number {get; Set; }} Public class matching {public favored matchID {get; Set; } Public Date Time? Playtime {receive; Set; } Public Team HomeTem {Receive; Set; } Public team avatama {receive; Set; } Public int? Homeskot {Get; Set; } Public int? AwayScore {get} Set; }} Public Class Pool {Public Entity Pool ID {Received; Set; } Public String PoolName {get; Set; } Public Date Time? Start Time {Receive; Set; } Public listing & lt; Team & gt; Teams {receive; Set; } Public listing & lt; Match & gt; Match {Received; Set; } Public listing & lt; Permanent & gt; Standings {get; Set; }}
Can you use .NET 3.5? For this LINQ is very easy to use OrderBy
and by
extension methods.
Comments
Post a Comment