You can create a new folder under Helpers under the root and physically save your classes. I would save my classes under a different Helpers namespace
namespace MyProject.Helpers { public class CustomerHelper {
To activate this in my other classes (e.g. controllers), I can either use the full name
var custHelper=new MyProject.Helpers.CustomerHelper();
OR
add an Import statement at the top so I can skip the full name
//Other existing Import statements here using MyProject.Helpers; public class RackController : Controller { public ActionResult Index() { var custHelper=new CustomerHelper(); //do something with this return View(); } }
If you think that your Helper method can be used in another project, you can consider it physically physical in a separate project (type class libraries). To use this in your project, add a link to this project and use it as what we did above (use either the full name or use the import statement)
Shyju Jul 17 2018-12-12T00: 00Z
source share