0
任何人都可以幫我解決它嗎? 我有2類型的錯誤消息無法轉換lambda表達式&名稱'_'在當前上下文中不存在
「closure_」沒有在當前的背景下存在的名稱
無法轉換lambda表達式鍵入「System.Delegate」,因爲 它是不是委託型
的代碼是:
private void backgroundWorker3_DoWork(object sender, DoWorkEventArgs e)
{
HtmlAgilityPack.HtmlDocument htmlDocument = new HtmlAgilityPack.HtmlDocument();
string text = this.textBox5.Text;
htmlDocument.LoadHtml(text);
HtmlNodeCollection htmlNodeCollection = htmlDocument.DocumentNode.SelectNodes("//img/@alt");
int num1 = 0;
int k = 0;
if (htmlNodeCollection == null || this.backgroundWorker3.CancellationPending)
return;
string links = "";
foreach (HtmlNode htmlNode in (IEnumerable<HtmlNode>) htmlNodeCollection)
{
HtmlNode aTag = htmlNode;
int num2 = int.Parse(this.textBox7.Text);
this._busy.WaitOne(-1);
if (!this.backgroundWorker3.CancellationPending)
{
++k;
this.Invoke((Delegate) (() => this.richTextBox4.AppendText(k.ToString() + "." + Environment.NewLine + aTag.InnerHtml + aTag.Attributes["alt"].Value + Environment.NewLine + Environment.NewLine)));
++num1;
}
this.Invoke((Delegate) (closure_0 ?? (closure_0 = (Action) (() => links = this.richTextBox4.Text + Environment.NewLine))));
System.IO.File.WriteAllText(this.textBox2.Text + "/Descriptions.txt", links);
if (num1 == num2)
{
this.backgroundWorker3.CancelAsync();
if (!this.backgroundWorker3.CancellationPending)
this._busy.Reset();
}
}
}
三江源
謝謝你這麼多,我是c#中的新手,我丟失了我非常老的源代碼,所以我用jetbrain dotpeek反編譯我的程序。我真的不明白一些缺少的代碼。現在你解決了我的問題,再一次,謝謝你, – userrrrrrr