Use variable in place of function name

后端 未结 6 1588
自闭症患者
自闭症患者 2021-02-09 13:16

I\'m using the following right now:

foreach (string file in files) {
    switch (filetype.Value) {
        case \"ReadFile\":
            ReadFile(file);
                


        
6条回答
  •  遇见更好的自我
    2021-02-09 13:37

    You could also use reflection (if you're okay with the different overhead that can bring) Check this solution

    Hope that helped

提交回复
热议问题