fork download
  1. using System;
  2.  
  3. public class Test
  4. {
  5. interface ITest
  6. {
  7. }
  8.  
  9. class ServiceBase<T>
  10. {
  11. public Channel InnerChannel { get; }
  12. }
  13.  
  14. class Channel
  15. {
  16. }
  17.  
  18. interface IMyBase
  19. {
  20. Channel MyInnerChannel { get; }
  21. }
  22.  
  23. class ServiceClient : ServiceBase<ITest>, IMyBase
  24. {
  25. public string Data { get; set; }
  26.  
  27. public Channel MyInnerChannel { get { return base.InnerChannel; } }
  28. }
  29.  
  30. static string GetFoo2() {
  31. return Execute((ServiceClient clnt) => clnt.Data);
  32. }
  33.  
  34. static TResult Execute<TService, TResult>(Func<TService, TResult> fnc)
  35. where TService : /*ServiceBase<TInterface>,*/ IMyBase, /*IDisposable,*/ new()
  36. {
  37. TService service = new TService();
  38. Channel channel = service.MyInnerChannel;
  39.  
  40. return default(TResult);
  41. }
  42.  
  43. public static void Main()
  44. {
  45. Test.GetFoo2();
  46. }
  47. }
Success #stdin #stdout 0s 130944KB
stdin
Standard input is empty
stdout
Standard output is empty