Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Jul 15th, 2012  |  syntax: None  |  size: 0.32 KB  |  hits: 12  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. Can I emit CIL inside an existing method?
  2. public void Worker()
  3. {
  4.     while(true)
  5.     {
  6.         int a = queueA.Dequeue();
  7.         int b = queueB.Dequeue();
  8.  
  9.         int c = Calculate(a,b);
  10.     }
  11. }
  12.  
  13. int Calculate(int a, int b)
  14. {
  15.     // here goes dynamic code.
  16.     // could be return a - b;
  17.     // could be return b - a;
  18. }