© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
12 replies
UntoldTitan

✅ Combining a List inside of a Select

I have an object:
    public class BackendSuccess
    {
        [Key]
        public int id { get; set; }
        public DateTime creationDate { get; set; }
        public ICollection<Label> labels { get; set; } = new List<Label>(); // BEEEEG list of base64 encoded labels
    }
    public class BackendSuccess
    {
        [Key]
        public int id { get; set; }
        public DateTime creationDate { get; set; }
        public ICollection<Label> labels { get; set; } = new List<Label>(); // BEEEEG list of base64 encoded labels
    }

And when i want to grab them all from the database, I want them combined by
creationDate
creationDate
using LINQ.

For example:
creationDate:2023-12-15, labels:[{1},{2}]
creationDate:2023-12-15, labels:[{1},{2}]
and
creationDate:2023-12-15, labels:[{3},{4}]
creationDate:2023-12-15, labels:[{3},{4}]

would combine to create
creationDate:2023-12-15, labels:[{1},{2},{3},{4}]
creationDate:2023-12-15, labels:[{1},{2},{3},{4}]

The order of the elements in
labels
labels
doesn't matter, I just want them combined.
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

add multiple values inside a list
C#CC# / help
4y ago
❔ List that has a list inside, and an identifier
C#CC# / help
3y ago
❔ Set item to null inside a list
C#CC# / help
4y ago