I'll start by I have no idea on the terminology on this or if it is even possible (I am pretty sure it can be done).
I have a chunk of code that is basically as follows:
DataTable dt = new DataTable();
if (string = "this")
dt = method1();
else if (string = "that")
dt = method2();
else if (string = "somethingelse")
dt = method3(datetime, datetime2);
else if (string = "anotherthing")
dt = method4(string);
....and so on....
I am trying to make this cleaner. The comparison string is in a table. My thought would be to do something more like the following:
if (row.parmtype = "date"){
dt = row.method(datetime, datetime2);
else
dt = row.method();
So the method I call would be stored in the table along with the type of call it is (there are only 3 types so far). Each call returns a DataTable. Can I either get a sample for better yet, a resource on how to do this?
Realize that since I don't know what I am talking about, the above code isn't exactly what I am looking for, but is for the purpose of getting my point across.