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