C#/.NET Little Wonders: First() and Single() - Similar Yet Different

added by BlackRabbitCoder
4/17/2011 7:55:34 AM

144 Views

Once again, in this series of posts I look at the parts of the .NET Framework that may seem trivial, but can really help improve your code by making it easier to write and maintain. Today we're going to look at two LINQ extension methods that are both very similar and yet very different.  Logically, First() and Single() serve similar purposes, but there is a subtle difference between these two that if you aren't expecting it may give you different behaviors.


0 comments