title: Is metaprogramming possible in C#?
body: <p>In particular, would it be possible to have <strong>code similar to this c++ code executed at compile time in c#</strong>?</p>
  
  <pre><code>template &lt;int N&gt;
  struct Factorial 
  {
      enum { value = N * Factorial&lt;N - 1&gt;::value };
  };
  
  template &lt;&gt;
  struct Factorial&lt;0&gt; 
  {
      enum { value = 1 };
  };
  
  // Factorial&lt;4&gt;::value == 24
  // Factorial&lt;0&gt;::value == 1
  void foo()
  {
      int x = Factorial&lt;4&gt;::value; // == 24
      int y = Factorial&lt;0&gt;::value; // == 1
  }
  </code></pre>