Reputation: 4174
Like the title said, In what folder should I put my extension methods in ASP.Net MVC?
What is the best practice for this?
Upvotes: 27
Views: 9931
Reputation: 9412
I don't believe that there is a standard best practice to follow, but I usually do one of two things:
ProjectName.Extensions/System/StringExtensions.cs
ProjectName.Extensions/System.Web/HttpContextExtensions.cs
ProjectName.Extensions/System.Xml/XmlWriterExtensions.cs
And so on...
Regardless of which approach I take, in both cases I'll name the class ClassNameExtensions.cs
(e.g., StringExtensions.cs, ListExtensions.cs, etc.).
Upvotes: 36