title: What's the proper way to emulate C++ macros in C#
body: <p>I understand why macros were not included in the language; that they can easily become abused. However I now and again stumble upon situations where they seem desirable. Just recently I was writing a method to log image files:</p>
  
  <pre><code>public void LogImage(Bitmap image, string name)
  {
      image.Save(LogRootDirectory + name + ".bmp");
  }
  </code></pre>
  
  <p>Subsequently, I thought it clever to utilize the nameof() feature to better provide information about the image I am logging. In several places in my code I have lines very similar to this:</p>
  
  <pre><code>ImageLogger?.LogImage(processedImage, nameof(processedImage));
  </code></pre>
  
  <p>What bothers me is the repetitiveness of this and I would much prefer a pre-processor command similar to this:</p>
  
  <pre><code>#define LOGIMAGE(img) ImageLogger?.LogImage(img, nameof(img));
  </code></pre>
  
  <p>Is there a way to emulate the above macro behaviour to better streamline my code?</p>
  
  <p>Note: <a href="https://stackoverflow.com/questions/709463/c-sharp-macro-definitions-in-preprocessor">This</a> question differs in that the author is asking if per-processor definitions exist in C#. An assertion that I made clear from the beginning that I know that they do not. My question is in reference to techniques that I may use in substitution. Which I believe was provided to me in the marked answer.</p>