© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•3y ago•
21 replies
barcode

✅ EFCore LINQ methods

I have this function
    public async Task<IReadOnlyList<Review>> GetByCenterId(uint id, uint page, uint count)
    {
        return await _dbContext.Reviews
            .Where(x => x.CenterId == id)
            .OrderBy(x => x.CreatedAt)
            .Skip((int)(page * count))
            .Take((int)count)
            .ToListAsync();
    }
    public async Task<IReadOnlyList<Review>> GetByCenterId(uint id, uint page, uint count)
    {
        return await _dbContext.Reviews
            .Where(x => x.CenterId == id)
            .OrderBy(x => x.CreatedAt)
            .Skip((int)(page * count))
            .Take((int)count)
            .ToListAsync();
    }


and naturally pages and count cannot be negative so I use uint, however I must cast it as no Skip or Take method exists for uint, is this the way it should be done or should I use int as parameters?
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

✅ LINQ / EFCore
C#CC# / help
3y ago
Efcore Dynamic Linq, AND and OR
C#CC# / help
4mo ago
FirstOrDefault and other methods are not working in LINQ
C#CC# / help
11mo ago
Why are Linq methods incomplete? (MinBy, MaxBy, etc.) [Answered]
C#CC# / help
4y ago