fork download
  1. using System;
  2. using System.Linq.Expressions;
  3.  
  4. namespace X
  5. {
  6. public class ObjectSet<T>
  7. {
  8. public T[] x;
  9. }
  10.  
  11. public static class ObjectContextExtensions
  12. {
  13.  
  14. public static T[] Find<T>(this ObjectSet<T> set, int id, params string[] includes) where T : class
  15. {
  16. Console.WriteLine("second");
  17. return set.x;
  18. }
  19.  
  20. public static T[] Find<T>(this ObjectSet<T> set, int id, params Expression<Func<T, object>>[] includes) where T : class
  21. {
  22. Console.WriteLine("first");
  23. return set.x;
  24. }
  25.  
  26.  
  27. }
  28.  
  29. public class Test
  30. {
  31. public static void Main()
  32. {
  33. new ObjectSet<string>().Find(0);
  34. Console.ReadKey();
  35. }
  36. }
  37. }
Compilation error #stdin compilation error #stdout 0.04s 36792KB
stdin
Standard input is empty
compilation info
prog.cs(33,37): error CS0121: The call is ambiguous between the following methods or properties: `X.ObjectContextExtensions.Find<string>(this X.ObjectSet<string>, int, params string[])' and `X.ObjectContextExtensions.Find<string>(this X.ObjectSet<string>, int, params System.Linq.Expressions.Expression<System.Func<string,object>>[])'
prog.cs(14,27): (Location of the symbol related to previous error)
prog.cs(20,27): (Location of the symbol related to previous error)
Compilation failed: 1 error(s), 0 warnings
stdout
Standard output is empty