PipelineMethodInvoker.cs 879 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. 
  2. using System;
  3. namespace MECF.Framework.UI.Client.ClientBase.Pipelines
  4. {
  5. public class PipelineMethodInvoker<TResult>
  6. {
  7. public PipelineMethodInvoker(Func<TResult> func)
  8. {
  9. Function = func;
  10. }
  11. public bool IsEmpty => Function == null;
  12. public Func<TResult> Function { get; }
  13. public TResult Invoke()
  14. {
  15. return Function.Invoke();
  16. }
  17. }
  18. public class PipelineMethodInvoker<TParam, TResult>
  19. {
  20. public PipelineMethodInvoker(Func<TParam, TResult> func)
  21. {
  22. Function = func;
  23. }
  24. public bool IsEmpty => Function == null;
  25. public Func<TParam, TResult> Function { get; }
  26. public TResult Invoke(TParam arg)
  27. {
  28. return Function.Invoke(arg);
  29. }
  30. }
  31. }