take a look at the following code I attempted to write inside a constructor:
private Predicate<string> _isValid;
//...
Predicate<string> isValid = //...;
this._isValid = isValid ?? s => true;
The code doesn't compile - just "invalid expression term"s and so one.
In contrast that does compile and I could just use it:
this._isValid = isValid ?? new Predicate<string>(s => true);
However, I still wonder why this syntax is not allowed.
Any ideas?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…