I have this code:
String temp = txtForm.Rtf;
foreach (ReplaceStrut rs in replaceArray) {
temp = temp.Replace(rs.getNeedle(), rs.getReplacement());
}
if (this.InvokeRequired) {
this.Invoke(temp => txtForm.Rtf = temp);
} else {
txtForm.Rtf = temp;
}
But it won't compile. It complains about two things, "Cannot convert lambda expression to type 'System.Delegate' because it is not a delegate type" and, "A local variable named 'temp' cannot be declared in this scope because it would give a difference meaning to 'temp', which is already used in a 'parent or current' scope to denote something else"
Both error are on the lambda line. How can I make this work, what am I doing wrong?