mardi 2 juillet 2019

Run correct method based on file name (C#)

I'm checking name of the file and return TRUE if it's correct:

bool name_FORD = file.Contains("FORD"); 
bool name_KIA =  file.Contains("KIA");  
bool name_BMW = file.Contains("BMW");

Based on this I want to have switch and run correct method. But I confused how to correctly do it:

switch (???)
{
 case 1 "BODS": 
              method1();
              break();
 case 2 "":
              method2();
              break();
 case 3 "":
              method3();
              break();
}

Aucun commentaire:

Enregistrer un commentaire