OpenFileDialog/c# slow on any file. better solution?

前端 未结 4 643
栀梦
栀梦 2020-12-16 12:34

I am opening a file using the OpenFileDialog in c# and I am noticing it is taking between 20-40 seconds to load my file and clear the dialog.

Here is my sample code

4条回答
  •  执笔经年
    2020-12-16 13:10

    I also had this problem when I want to open a example.url file with file open dialog. It takes 0-10 seconds. Then I find out that this has something todo with the file type association (*.url) When I changed the association from default web browser to notepad++ the problem was gone. But I this was no solution for me, because when somebody clicked on a example.url, the default browser should open this file. To solve this I added DereferenceLinks = false.

    OpenFileDialog ofd = new OpenFileDialog
    {
    ...
       DereferenceLinks = false
    };
    

    For me this solution works perfect

提交回复
热议问题