How to handle exceptions in LINQ?
How to handle exceptions in LINQ?
Use try-catch around enumeration, not the query:
try {
var result = employees.First(e => e.Salary > 999999);
} catch (Exception ex) {
Console.WriteLine("No match found.");
How to handle exceptions in LINQ?
Use try-catch around enumeration, not the query:
try {
var result = employees.First(e => e.Salary > 999999);
} catch (Exception ex) {
Console.WriteLine("No match found.");