I\'m using the following right now:
foreach (string file in files) {
switch (filetype.Value) {
case \"ReadFile\":
ReadFile(file);
You can do it with some preparation using delegates, like this:
private static readonly IDictionary> actionByType =
new Dictionary> {
{"ReadFile", ReadFile}
, {"ReadMSOfficeWordFile", ReadMSOfficeWordFile}
, {"ReadMSOfficeExcelFile", ReadMSOfficeExcelFile}
, {"ReadPDFFile", ReadPDFFile}
};
When it is time to call your action, do it as follows:
actionByType[actionName](file);