A first chance exception of type 'System.NullReferenceException' occurred in .dll. I cannot figure out why all.FindAll(...) throws this exception every time. Is the reason because the lambda expression is not short circuiting the AND OR conditions which is causing the Name, BillingCity, and or BillingStreet to cause this? Also I'm open to a better approach (like a working one =)) to my current solution.
public async Task<JsonResult> AutoCompleteSearch(string term)
{
// Filter accounts
List<Account> all = await GetAccounts();
List<Account> filtered = new List<Account>();
filtered = all.FindAll(e =>
((e.Name != null) && e.Name.ToLower().Contains(term.ToLower())) ||
((e.BillingCity != null) && e.BillingCity.ToLower().Contains(term.ToLower())) ||
((e.BillingStreet != null) && e.BillingState.ToLower().Contains(term.ToLower())));
return Json(filtered, JsonRequestBehavior.AllowGet);
}