.NET - Very strange NullReferenceException?

Posted by ropstah on Stack Overflow See other posts from Stack Overflow or by ropstah
Published on 2010-06-08T01:10:52Z Indexed on 2010/06/08 1:22 UTC
Read the original article Hit count: 366

How can I get a NullReferenceException in the following scenario?

 Dim langs As IEnumerable(Of SomeCustomObject) = //some LINQ query
 If langs Is Nothing Then Return Nothing 
 If langs.Count = 1 Then //NullReferenceException here

What am I missing here? Debug shows that langs is really just a LINQ queryresult without any results...

© Stack Overflow or respective owner

Related posts about .NET

Related posts about nullreferenceexception