I need a method that return me some parameters in controllers this is implementation of it:
public List<Parameter> GetParameters(FormCollection collection) {
List<Parameter> parameters = new List<Parameter>();
List<string> parameterNames = new List<string>();
//Get Parameters Names and Values
return parameters;
}
I use this method in all of controllers, So I think about 3 option that I have to define it:
1-For any controller class define it in that controller like this:
public class ProductController : Controller {
public List<Parameter> GetParameters(FormCollection collection) {
//
}
}
2-Define it in static class as static method:
public static class GeneralMethods {
public static List<Parameter> GetParameters(FormCollection collection) {
//
}
}
3-Define it as a None Static :
public class GeneralMethods {
public List<Parameter> GetParameters(FormCollection collection) {
//
}
}
which one is better? which one have better performance? or any other option for define methods that used in many controllers? what is your suggestion?