Hi
I want to use the LINQ to fetch only the records that falls between startValue and endValue. I don't want to loop all the records. How can i do that?
var citedWorks = All().Where(c => c.CreatedDate >= StartDate && c.CreatedDate <= EndDate).ToList();
List<CitedWork> selectedCitedWork =new List<CitedWork>();
foreach(var citedWork in citedWorks)
{
var callNumber = string.IsNullOrEmpty(GetLocalClassNumbersBy(citedWork.Id,true))?null:GetLocalClassNumbersBy(citedWork.Id,true).Substring(0,1);
if(callNumber!=null && (String.CompareOrdinal(callNumber,startValue.Substring(0,1))>=0 && String.Compare(callNumber,endValue.Substring(0,1))<=0))
{
selectedCitedWork.Add(citedWork);
}
}
return selectedCitedWork;