I have a project where I request users by the first letter:
repository.GetAll().Where(q => q.BrukerIdent.StartsWith(letter.ToString())).ToList();
.. where repository.GetAll() returns IQueryable<Bruker> , BrukerIdent is the string containing the username, and letter is the char value. This works fine except that I also want to get users that start with numbers. And I do not want to sort by individual numbers.
My mind yells at StartsWith("\d") , but as far as I find out, it doesn't work that way. I also thought about doing a 10-position OR sentence, but it will look like spaghetti, and I'm not sure about the effectiveness.
Is there a “right” way to do it this way?
source share