DefaultIfEmpty doesn't work

Posted by Freshblood on Stack Overflow See other posts from Stack Overflow or by Freshblood
Published on 2010-06-13T07:48:31Z Indexed on 2010/06/13 7:52 UTC
Read the original article Hit count: 266

Filed under:
|
|
|
|

Why is array still null after queried by DefaultIfEmpty ?

class Program
    {

        static void Main(string[] args)
        {
            Program[] array = new Program[5];
            Program[] query = array.DefaultIfEmpty(new Program()).ToArray();
            foreach (var item in query)
            {
                Console.WriteLine(item.ToString());
            }
            Console.ReadKey();
        }
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about .NET