How to achieve this same below with switch statement,
public static string GetPathWithPrefix(string path)
{
string pathWithPrefox = string.Empty;
if(path == ConfigurationManager.AppSettings["path1"])
{
pathWithPefix = ConfigurationManager.AppSettings["path1WithPrefix"];
}
else if(path == ConfigurationManager.AppSettings["path2"])
{
pathWithPefix = ConfigurationManager.AppSettings["path2WithPrefix"];
}
else if(path == ConfigurationManager.AppSettings["path3"])
{
pathWithPefix = ConfigurationManager.AppSettings["path3WithPrefix"];
}
return pathWithPefix;
}
I am getting compilation error when using ConfigurationManager.AppSettings["path1"]
in case of switch.