title: Replacing all usages of a method (Introduce Indirection)
body: <p>I am generally not very fond of refactoring tools. No need to get into details. Still, I occasionally try out new versions. Here is what I was trying to do while evaluating resharper 4.5 :</p>
  
  <p>I needed to replace all usages of a method with a wrapper method (to be created) but I could not. I usually suck at noticing an obvious feature, is this the case? If resharper does not have this feature, do you know such tools?</p>
  
  <p>Edit 2: Sample has been improved to include instance method calls.
  Edit:
  Here is a simple case to play.</p>
  
  <pre><code>    static void Main(string[] args)
      {
          while(true)
          {
              if (Console.ReadKey().Key == ConsoleKey.Escape)
              {
                  Thread.Sleep(10);
                  if (Quiting()) break;
              }
              Console.Beep(250, 50);
          }
      }
  
      static bool Quiting()
      {
          if (Console.In.Peek() &gt; 0)
          {
              Console.Beep(250, 150);
              return false;
          }
          return true;
      }
  </code></pre>
  
  <p>What I need is something like: (Edit2: added an instance sample)</p>
  
  <pre><code>    private static StringBuilder _builder = new StringBuilder();
  
      static void Main(string[] args)
      {
          while(true)
          {
              var key = Console.ReadKey();
              if (key.Key == ConsoleKey.Escape)
              {
                  Thread.Sleep(10);
                  if (Quiting()) break;
              }
              _builder.Append(" (").Append(key.KeyChar).Append(") ");
              Beep(250, 50);
          }
      }
  
      static bool Quiting()
      {
          if (Console.In.Peek() &gt; 0)
          {
              Beep(250, 150);
              _builder.Append('@');
              return false;
          }
          return true;
      }
  
      static void Beep(int frequency, int duration)
      {
          // finally cursor ends up here
          Console.Beep(250, 50);
      }
  </code></pre>
  
  <p>Console.Beep calls are refactored. Next lets refactor StringBuilder.Append(char) :</p>
  
  <pre><code>class Program
  {
      private static StringBuilder _builder = new StringBuilder();
  
      static void Main(string[] args)
      {
          while(true)
          {
              var key = Console.ReadKey();
              if (key.Key == ConsoleKey.Escape)
              {
                  Thread.Sleep(10);
                  if (Quiting()) break;
              }
              _builder.Append(" (").AppendUpper(key.KeyChar).Append(") ");
              Beep(250, 50);
          }
      }
  
      static bool Quiting()
      {
          if (Console.In.Peek() &gt; 0)
          {
              Beep(250, 150);
              _builder.AppendUpper('n');
              return false;
          }
          return true;
      }
  
      static void Beep(int frequency, int duration)
      {
          // finally cursor ends up here
          Console.Beep(250, 50);
      }
  }
  
  static class StringBuilderExtensions
  {
      public static StringBuilder AppendUpper(this StringBuilder builder, char c)
      {
          return builder.Append(char.ToUpper(c));
      }
  }
  </code></pre>
  
  <p>Selecting from usages and maybe omitting common parameters (such as 250 above) or common instance parameters for non-extension statics shall make this feature more valuable. Hopefully, this clears up the question.</p>