string [] files = new string[2];
files[0] = "ThinkFarAhead.Example.Settings.Configuration_Local.xml";
files[1] = "ThinkFarAhead.Example.Settings.Configuration_Global.xml";
//Resharper complains this is an "access to modified closure"
for (int i = 0; i < files.Length; i++ )
{
// Resharper disable AccessToModifiedClosure
if(Array.Exists(Assembly.GetExecutingAssembly().GetManifestResourceNames(),
delegate(string name) { return name.Equals(files[i]); }))
return Assembly.GetExecutingAssembly().GetManifestResourceStream(files[i]);
// ReSharper restore AccessToModifiedClosure
}
尽管ReSharper抱怨这是“访问修改后的闭包”,但上述方法似乎运行良好。有人可以阐明这一点吗?
(此主题在此继续)
6
链接已经出来了,但我发现它在WebArchive:web.archive.org/web/20150326104221/http://www.jarloo.com/...
—
埃里克·吴