c# - Check if a string has at least one number in it using LINQ

"abc3def".Any(c => char.IsDigit(c)); Update : as @Cipher pointed out, it can actually be made even shorter: "abc3def".Any(char.IsDigit);... Read More

c# - Code equivalent to the 'let' keyword in chained LINQ extension method calls

Let doesn't have its own operation; it piggy-backs off of Select. You can see this if you use "reflector" to pull apart an existing dll. it will be something like: var result = names .Select(... Read More

c# - LINQ to SQL - Left Outer Join with multiple join conditions

You need to introduce your join condition before calling DefaultIfEmpty(). I would just use extension method syntax: from p in context.Periods join f in context.Facts on equals f.periodid into f... Read More

c# - ILookup<TKey, TVal> vs. IGrouping<TKey, TVal>

Yes, all of those are correct. And ILookup<TKey, TValue> also extends IEnumerable<IGrouping<TKey, TValue>> so you can iterate over all the key/collection pairs as well as (or instead of) just looking... Read More

c# - How to Convert all strings in List<string> to lower case using LINQ?

Easiest approach: myList = myList.ConvertAll(d => d.ToLower()); Not too much different than your example code. ForEach loops the original list whereas ConvertAll creates a new one which you need to r... Read More

c# - Freely convert between List<T> and IEnumerable<T>

List<string> myList = new List<string>(); IEnumerable<string> myEnumerable = myList; List<string> listAgain = myEnumerable.ToList();... Read More

c# - Sequence contains no matching element

Well, I'd expect it's this line that's throwing the exception: var documentRow = _dsACL.Documents.First(o => o.ID == id) First() will throw an exception if it can't find any matching elements. Given... Read More

Linq to SQL how to do "where [column] in (list of values)"

Use where list.Contains(item.Property) Or in your case: var foo = from codeData in channel.AsQueryable<CodeData>() where codeIDs.Contains(codeData.CodeId) select codeData; But you... Read More

c# - How to perform Join between multiple tables in LINQ lambda

For joins, I strongly prefer query-syntax for all the details that are happily hidden (not the least of which are the transparent identifiers involved with the intermediate projections along the way... Read More

c# - Select multiple records based on list of Id's with linq

You can use Contains() for that. It will feel a little backwards when you're really trying to produce an IN clause, but this should do it: var userProfiles = _dataContext.UserProfile... Read More