[Mono-list] Max(string) causes InvalidOperationException on empty IEnumerable

Andrus kobruleht2 at hot.ee
Mon May 18 09:21:56 EDT 2009


Code below causes InvalidOperationException  in Mono 2.4 
Is this known issue ?

Andrus.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;

public class Test
{
    public static void Main()
    {
        try
        {
            IEnumerable<string> e = new string[0];
            var x = e.Max();
            System.Windows.Forms.MessageBox.Show((x == null).ToString());
        }
        catch (Exception ex)
        {
            System.Windows.Forms.MessageBox.Show(ex.ToString());
        }
    }
}




More information about the Mono-list mailing list