issue fixed.
I used a local variable in function lambda expression. It should be a calss variable obviously..
Вопрос
when creating new Func<> what is the value of Target property?
Im creating this Func object in constructor of class A which has base class B. In B I compare objects like this :
func.Target != this
which is true..
And I dont simply understand why it is not false..
thanks
Решение 2
issue fixed.
I used a local variable in function lambda expression. It should be a calss variable obviously..
Другие советы
Maybe this can help:
static void Main(string[] args)
{
Program p = new Program();
p.MainImpl();
}
public void MainImpl() {
Func<string> f = null;
Program _this = this;
f = () => {
Console.WriteLine(this == f.Target);
Console.WriteLine(this == _this); return null;
};
//Prints "False True"
f();
}