SingleOrDefault Vs FirstOrDefault

Опубликовано: 20 Октябрь 2024
на канале: Dimitri Patarroyo
32
0

SingleOrDefault will throw and exception if the result value is repeated. On the other hand FirstOrDefault will NOT throw an exception if the result value is repeated, it will simply get the first values and finish the iteration as soon as it got it.
If none value is found, both methods will return a null value or response 204.