It sounds like you want:
var familyId = ( from item in locationIds from I in context.TblInsuree // ... etc && D.ValidityTo == null) select F.FamilyId) .FirstOrDefault();
- Shortening loop to one QUERY in LINQ
- Converting foreach loop to LINQ query breaks code
- LINQ query to perform a projection, skipping or wrapping exceptions where source throws on IEnumerable.GetNext()
- Linq query built in foreach loop always takes parameter value from last iteration
- Is there any way to create a LINQ query as a variable without having the data source (yet)?
- Linq query with multiple OrderBy statements added in a loop
- Convert async loop to LINQ query
- LINQ Source Code Available
- Loop Through LINQ Query Columns (Not rows)
- Replace for-switch loop with a Linq query
- linq - how do you do a query for items in one query source that are not in another one?
- How can I write the following code more elegantly using LINQ query syntax?
- How to dynamic add filters to a LINQ query against an Odata Source in C#
- Avoid extra loop and could not find implementation of query pattern for source type int Select not found
- C# Linq query help removing foreach loops creating cleaner code
- Use a linq query as microsoft local report Data Source (WinForms)
- Determine the source DataContext for a Linq to Sql query
- LINQ query returns old results when source list is re-initialized
- How to get SQL query into LINQ form in C# code
- convert foreach loop to linq code
- Which way is better Linq Select Query or For Loop to search something in generic List?
- How can I code a Linq query to do an upward Include?
- Loop through array in linq query
- creating Linq to sqlite dbml from DbLinq source code
- Identify source of linq to sql query
- NHibernate LINQ query performance, which code fragment is better?
- Linq sub query when using a repository pattern with EF code first
- ASP.NET LINQ query for filter and loop through multiple tables
- Using LINQ query result for data source for GridControl c#
- Using a LINQ query instead of a foreach loop
- OrderBy to sort a 2D array in .NET C#
- How to do this multi-dimension collection comparison (with or w/o LINQ)
- How to convert this foreach loop into Linq code?
- How i can split comma separated string in a group using LINQ
- Using SQL Server Filestream with LINQ
- Convert this LINQ code back to a Loop (or Why is this object sometimes null)
- Is it possible to handle exceptions within LINQ queries?
- Linq - how to combine two enumerables
- List within a List - How to put new line with LinQ after List within List is over?
- Retrieve two values in the same linq query
- How do I write a linq query against a ListCollectionView?
- Linq: GroupBy vs Distinct
- Equivalent of LINQ in Java 8
- Access Identity User and Role Tables in Linq
- C# loop over List<T> collection and find if value exists is saying projectname
- How do I cast this using LINQ?
- Fetch Items in LINQ where child entities fulfill certain conditions
- Identity Filter Linq .Where
- Using an Expression with Linq
- Extension Method makes LINQ break