c# - "The call is ambiguous" (Calling a method with the same data structure) -


i'm trying call method (emptyfoldercontents) (recent) system variable, message:

the call ambiguous between following methods or properties

so how rename/change this?

string recent = environment.expandenvironmentvariables("%userprofile%") + "\\recent";  emptyfoldercontents(recent);  private void emptyfoldercontents(string foldername) {     foreach (var folder in directory.getdirectories(foldername))     {         try         {             directory.delete(folder, true);         }         catch (exception excep)         {             system.diagnostics.debug.writeline(excep);         }     }      foreach (var file in directory.getfiles(foldername))     {         try         {             file.delete(file);         }         catch (exception excep)         {             system.diagnostics.debug.writeline(excep);         }     } } 

it means have got 2 methods same signature in same scope. either remove unwanted method scope or change name of 1 method

       private void emptyfoldercontents_new(string foldername) 

then call this

       emptyfoldercontents_new(recent);  

Comments