Error A local variable cannot be declared in this scope

流过昼夜 提交于 2020-01-14 06:48:16

问题


I am trying to unzip a file with DotNetZip but I get a error on the "e"

using (ZipFile zip = ZipFile.Read(openFileDialog1.FileName))
{
    foreach (ZipEntry e in zip)
    {
        e.Extract(Environment.CurrentDirectory, ExtractExistingFileAction.OverwriteSilently);
    }
}

回答1:


I suspect you are doing this inside an event handler which already has a parameter called e.

Try renaming e to entry inside the foreach.



来源:https://stackoverflow.com/questions/16263099/error-a-local-variable-cannot-be-declared-in-this-scope

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!