© 2026 Hedgehog Software, LLC

TwitterGitHubDiscord
More
CommunitiesDocsAboutTermsPrivacy
Search
Star
Setup for Free
C#C
C#•2y ago•
14 replies
Davaaron

Api Method Name Attribute

Hi,

i just wonder what the name property inside the HttpMethod attribute is for? I read it can be used in MVC a lot when calling other controllers or getting their routes. So I have something like

[HttpDelete(Name = "DeleteLocation")]
public IActionResult Delete([FromQuery] int id)
{
     return Ok(""Deleted"");
}
[HttpDelete(Name = "DeleteLocation")]
public IActionResult Delete([FromQuery] int id)
{
     return Ok(""Deleted"");
}


Im usually used to something like
[HttpDelete("{id}")]
[HttpDelete("{id}")]
. I cannot specify both, right? I just create an api and want to be documentative/verbose about my code
C# banner
C#Join
We are a programming server aimed at coders discussing everything related to C# (CSharp) and .NET.
61,871Members
Resources

Similar Threads

Was this page helpful?
Recent Announcements

Similar Threads

✅ how to check attribute name?
C#CC# / help
2y ago
Get method for API
C#CC# / help
4y ago
✅ Apply multiple attributes from custom attribute
C#CC# / help
2y ago