Error using the File.Delete method inside the Controller

7

I'm having problems with my controller the moment I start a file exclusion routine.

I'm using the File.Delete() method, but it just does not recognize and returns the following warning:

  

Can not choose method from method group. Did you intend to invoke the method?

Follow the code too:

public void Delete(String id)
{
    //Função que busca o meu arquivo de delete
    var modelArquivo = BuscaArquivo(id);

    //Aqui se atribue o nome completo do arquivo
    var nomeArquivo = modelArquivo.NomeArquivoCompleto;

    //Aqui da-se a advertência citada acima
    File.Delete(nomeArquivo);         
}

Any ideas on what's happening?

    
asked by anonymous 14.02.2014 / 13:19

2 answers

7

It seems to me like namespace conflict. You could test with:

System.IO.File.Delete(nomeArquivo)
    
17.02.2014 / 04:04
10

You've already tried using

//Aqui da-se a advertência citada acima
File.Delete(nomeArquivo); 

Use

System.IO.File.Delete(nomeArquivo)
    
14.02.2014 / 14:21