PageRenderTime 46ms CodeModel.GetById 17ms RepoModel.GetById 1ms app.codeStats 0ms

/mono/tests/bug-3903.cs

https://bitbucket.org/danipen/mono
C# | 28 lines | 22 code | 5 blank | 1 comment | 0 complexity | f88b8259751386ebe6f2781a5657f6db MD5 | raw file
Possible License(s): Unlicense, Apache-2.0, LGPL-2.0, MPL-2.0-no-copyleft-exception, CC-BY-SA-3.0, GPL-2.0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. struct Foo
  5. {
  6. }
  7. public class TestClass
  8. {
  9. public static int Main ()
  10. {
  11. Foo[][] array = new Foo[][] { new Foo[0] };
  12. IEnumerable<object> aa1 = array;
  13. foreach (var x in aa1) Console.WriteLine (x);
  14. aa1.GetEnumerator ().ToString ();
  15. int[] array2 = new int[10];
  16. IEnumerable<uint> aa2 = (uint[])(object)array2;
  17. foreach (var x in aa2) Console.WriteLine (x);
  18. aa2.GetEnumerator ().ToString ();
  19. // The next line will crash
  20. List<object> list = array.Cast<object>().Select((arg) => arg).ToList();
  21. return 0;
  22. }
  23. }