[interp] Reduce computation under calc_section mutex
[mono-project.git] / mcs / tests / gtest-linq-23.cs
blob5da3bba0c4f0dc34dabefd34a82d448b7a1bac29
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
5 namespace OrderByBugExample
7 class Foo
9 public string Name { get; set; }
10 public int Value1 { get; set; }
11 public int Value2 { get; set; }
14 static class Program
16 public static int Main ()
18 List<Foo> test = new List<Foo> ()
20 new Foo { Name="b", Value1=37, Value2=2 },
21 new Foo { Name="b", Value1=37, Value2=1 }
24 // Sort using a linq expression. Mono 2.6.1 ignores item.Value2, which is incorrect behaviour.
25 var result = from item in test
26 orderby item.Name, item.Value1, item.Value2
27 select item;
29 var r = result.ToList ();
31 foreach (Foo item in r)
32 Console.WriteLine ("{0}, {1}, {2}", item.Name, item.Value1, item.Value2);
34 if (r[0].Value2 != 1 && r[1].Value2 != 2)
35 return 1;
37 Console.WriteLine ("ok");
38 return 0;