You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the following scenario, keyword this is required; I assume this is because you have
two generic methods with both TController : Controller and TController : class.
This is annoying. Why do you need the TController: class version? Am I missing something?
Additionally, it'd be great if your extension methods lived under another namespace, and not the official Microsoft.AspNetCore.Mvc, mainly for clarity and extensibility. For example, to fix the above I thought of making a wrapper class in my namespace so that only the methods with TController : Controller are "locatable" in my code, but since I obviously need the official Microsoft.AspNetCore.Mvc namespace, then I get method name clashes. What do you think?
The text was updated successfully, but these errors were encountered:
@jorgeyanesdiez Hi, the this keyword is required by the C# language when your extension method is called from the extended class itself. I do not know any options to remove it.
As for the namespace, I will think about it. Thank you for the suggestion! 👍
In the following scenario, keyword
this
is required; I assume this is because you havetwo generic methods with both
TController : Controller
andTController : class
.This is annoying. Why do you need the
TController: class
version? Am I missing something?Additionally, it'd be great if your extension methods lived under another namespace, and not the official
Microsoft.AspNetCore.Mvc
, mainly for clarity and extensibility. For example, to fix the above I thought of making a wrapper class in my namespace so that only the methods withTController : Controller
are "locatable" in my code, but since I obviously need the officialMicrosoft.AspNetCore.Mvc
namespace, then I get method name clashes. What do you think?The text was updated successfully, but these errors were encountered: