fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. public static IFooController iFooController => (IFooController)new object();
  6. public static FooRequest CreateRequest<T>(Func<FooResponse<T>> func)
  7. {
  8. return FooRequest.Create(func);
  9. }
  10.  
  11. public static void Main()
  12. {
  13. var newRequest = CreateRequest(() => iFooController.GetEmployeeById("myPartner", 42, DateTime.Now.AddDays(-1)));
  14. }
  15. }
  16.  
  17. public class FooRequest
  18. {
  19. public static FooRequest Create<T>(Func<FooResponse<T>> func)
  20. {
  21. //Help please. We need to extract the name of the method and the values of the parameters
  22. return new FooRequest(null, null);
  23. }
  24.  
  25. public FooRequest(string function, object[] data = null)
  26. {
  27. //SendRequestToServiceBus(function, data);
  28. Console.Write($"Function name: {function}");
  29. }
  30. }
  31.  
  32. public class FooResponse<T> { }
  33.  
  34. public interface IFooController
  35. {
  36. FooResponse<string> GetEmployeeById(string partnerName, int employeeId, DateTime? ifModifiedSince);
  37. }
Success #stdin #stdout 0.01s 29664KB
stdin
Standard input is empty
stdout
Function: