Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

How to get the range of strings between two given string values (A to M) in LINQ?

$
0
0

Hi

I want to return all the strings from startValue (e.g. A) to endValue (e.g. M). 

By using LIKE we can do it like this - LIKE '[A-M]%' 

How can we write the same LIKE query in LINQ.

Thanks

return Find(m => m.CreatedDate >= startDate && m.CreatedDate <= endDate
&& m.Marc21Id == 15
&& m.Name != null
&& m.Name.StartsWith(startValue)
&& m.Name.EndsWith(endValue);


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>