title: Get MVC controller name from controller's class
body: <p>Is there an efficient way to get the control name <code>"HelloWorld"</code> when all I know is the class <code>HelloWorldController</code>?</p>
  
  <p>Maybe something like:</p>
  
  <p><strike>var str = HelloWorldController.NetExtensionMethodWhichRetursActionName(); // str = "HelloWorld"</strike>
  Edit: can't exist as (currently) extension method only exist for instances</p>
  
  <p>or</p>
  
  <pre><code>var str = NetUtilClass.MethodWhichRetursActionNameFromControllerclass(typeof(HelloWorldController)); // str = "HelloWorld"
  </code></pre>
  
  <p>or something else...</p>
  
  <p>I know I could write something like:</p>
  
  <pre><code>string GetName&lt;T&gt;() where T : Controller { var s = typeof(T).Name; return s.Delete(s.Length - "Controller".Length; }
  </code></pre>
  
  <p>but I guess this functionality is already available in the framework.</p>