Hello,
Can anyone please explain how to handle exception handling in lamda expression.
I know in Anonymous method we can use try catch method like,
Employee emp= listemp.Find(delegate(Employee employee)
{
try
{
if (number == 5)
throw new InvalidCastException();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
return employee.id == 101;
}
By converting above code into Lamda expression we have,
Employee e1 = listemp.Find(x => x.id == 101);
My question is that can we implement try catch with this expression?
Thanks
Krrish