© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•4y ago•
17 replies
malkav

✅ Sorting nested

So I've got this data model that looks something like this (some parts of the fields have been omitted as they are irrelevant)

public class UserMonth
{
  // ...
  public int Month {get;set;}
  public int Year {get;set;}
  public List<DaysWorked> DaysWorked {get;set;}
  // ...
}

public class DaysWorked
{
  public DateTime Date {get;set;}
  // ...
}
public class UserMonth
{
  // ...
  public int Month {get;set;}
  public int Year {get;set;}
  public List<DaysWorked> DaysWorked {get;set;}
  // ...
}

public class DaysWorked
{
  public DateTime Date {get;set;}
  // ...
}


I'm probably thinking too hard here and that's why I'm missing something simple, so I came here for help

I want to do the following in my component:

I've got a
List<UserMonth>
List<UserMonth>
in my component, and I want to render a table by week.
The user selects a month and a year they wish to view, and I am supposed to find the UserMonth that was selected (
List<UserMonth>.Select(x => x.Month == SelectedMonth && x.Year == SelectedYear)
List<UserMonth>.Select(x => x.Month == SelectedMonth && x.Year == SelectedYear)
.. should be easy enough)
Then I need to seperate the
List<DaysWorked>
List<DaysWorked>
into a nested list:
List<List<DaysWorked>>
List<List<DaysWorked>>
where I sort each week's dates in its own list, and add that list to the list (but keep it sorted?) (Or if there is a better way I'd love to hear it)
and then I have to render basically for each week, its own table

So does anyone have any ideas on how to do this?
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

EFC -> Nested Property Sorting
C#CC# / help
2y ago
✅ Bubbel sorting
C#CC# / help
11mo ago
✅ Leaderboard Sorting
C#CC# / help
13mo ago
Sorting Help.
C#CC# / help
3y ago