0

I have this database object for example

This we are getting from database

List<Employee> employee = [ {"id" : 1} ]

Now somewhere in my code, I'm accessing

var x = employee.SingleOrDefault(x => x.id.Equals(2) )

Now my code handles when x is null. Now I'm getting this exception saying "Index was outside the bounds of the error" so not sure what's happening.

I tried to see if the employee list is null or not but it always returns a list.

Jordec
  • 1,516
  • 2
  • 22
  • 43
jai
  • 1
  • 3

0 Answers0