Basically, I have something like the following:
public string SomeDBMethod(string server, string dbName, string userName, string password,...)
Is it good to reorganize it into the following:
public string SomeDbMethod(DBParams parameters, ...)
Where DBParams is defined as follows:
public struct DBParams { string Server {get;set;} string DbName {get;set;} string UserName {get;set;} string Password {get;set;} }
My point is to really be able to skip fewer parameters as I find functions with long parameter lists really ugly.
I also found that there are some limitations to this approach: if SomeDbMethod should be presented as a web service method, I cannot use the DBParams structure as a parameter (as far as I know about web services ... which is not very far).
So, is this too big a problem for little good or am I something here?
source share