MethodReference.cs 554 B

1234567891011121314151617181920212223242526272829303132
  1. using System;
  2. using System.Reflection;
  3. namespace SRF.Helpers
  4. {
  5. public class MethodReference
  6. {
  7. public MethodReference(object target, MethodInfo method)
  8. {
  9. SRDebugUtil.AssertNotNull(target, null, null);
  10. this._target = target;
  11. this._method = method;
  12. }
  13. public string MethodName
  14. {
  15. get
  16. {
  17. return this._method.Name;
  18. }
  19. }
  20. public object Invoke(object[] parameters)
  21. {
  22. return this._method.Invoke(this._target, parameters);
  23. }
  24. private MethodInfo _method;
  25. private object _target;
  26. }
  27. }