Advertisement
Guest User

Untitled

a guest
Jul 20th, 2019
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. class Program
  2. {
  3. static void Main(string[] args)
  4. {
  5. while(true){
  6. Somefunc();
  7. }
  8. }
  9.  
  10. static void Somefunc()
  11. {
  12. Console.WriteLine("Hello World");
  13. }
  14. }
  15.  
  16. class Program
  17. {
  18. static void Main(string[] args)
  19. {
  20. while(true){
  21. if(App1.SomeFuncIsCalled)
  22. InjectCode();
  23. }
  24. }
  25.  
  26. static void InjectCode()
  27. {
  28. App1.Console.WriteLine("Hello World Injected");
  29. }
  30. }
  31.  
  32. Hello World
  33. Hello World Injected
  34.  
  35. class Program
  36. {
  37. [ImportMany("AddinContractName", typeof(IRunMe))]
  38. public IEnumerable<IRunMe> ThingsToRun { get; set; }
  39.  
  40. void SomeFunc()
  41. {
  42. foreach(IRunMe thing in ThingsToRun)
  43. {
  44. thing.Run();
  45. }
  46. /* do whatever else ... */
  47. }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement