Is this possible, or am I just trying to way overly shorten my code?
I thought it might be something like:
IQueryable<string> trimmedStrs = untrimmedStrsArr.AsQueryable<string>().All(s => s.Trim());
But that’s no good 🙁
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think you want just:
If you have in-memory collection such as list or array, then you can work with them using LINQ methods for
IEnumerable<T>, because these process data in memory. Queryable is useful when working with databases (e.g. using LINQ to SQL).You can find a good documentation on various methods on MSDN. The following should explain why you need
Selectinstead ofAll:All– Determines whether all elements of a sequence satisfy a condition.Select– Projects each element of a sequence into a new form.