I have StoreProcedureConstant.cs file where I've defined constants. I am able to call the constants but can't do it with dynamic strings.
StoreProcedureConstant.cs
public const string testSP = "sp_testingtest";
public const string restSP = "sp_test1";
public const string SP1 = "sp_secondtest";
Service.cs
string[] paramlist = {"testSP","restSP","SP1"};
string[] except = {};
var newparams = paramlist.ToDictionary(key => key, value => value);
foreach (var param in newparams.Values)
{
Data = CommonDBService.ExecuteNonQuery(StoreProcedureConstant.param);
if (Data == false)
{
except.Append(param);
}
}
I have this other file Service.cs from where I am calling the constants from StoreProcedureConstant.cs file.
I am not able to call constants like StoreProcedureConstant.param
. So I've converted string array to dictionary but it is still not working.
I am new to c# and I think this is not possible. Please help!!