fork download
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Reflection;
  4. using System.Linq;
  5.  
  6. public class Test
  7. {
  8.  
  9. public void Delete<T>(T obj) where T : class {}
  10. public void Delete<T>(ICollection<T> obj) where T : class {}
  11.  
  12. public static MethodInfo GetMethod(Type type) {
  13. var res = type
  14. .GetRuntimeMethods()
  15. .Where(x => x.Name.Equals("Select"))
  16. .Select(m => new {Method = m, Parameters = m.GetParameters()})
  17. .FirstOrDefault();
  18. return res != null ? res.Method : null;
  19. }
  20.  
  21. public static void Main()
  22. {
  23. Console.WriteLine(GetMethod(typeof(Test)));
  24. }
  25. }
Success #stdin #stdout 0.04s 25456KB
stdin
Standard input is empty
stdout