6
This answer私の別の質問にはコンパイルされませんでしたが、表面上ではそうすべきです(これは同じ質問ではありません。コンパイラがnull合体演算子とトラブルに実行されているのはなぜヌル合体とラムダ
はなく、構文・無糖の場合/他のバージョンと、
private Func<MyT, bool> SegmentFilter { get; set; }
public MyConstructor(Func<MyT, bool> segmentFilter = null)
{
// This does not compile
// Type or namespace mas could not be found
SegmentFilter = segmentFilter ?? (mas) => { return true; };
// This (equivalent?) form compiles just fine
if (segmentFilter == null)
{
SegmentFilter = (mas) => { return true; };
}
else
{
SegmentFilter = segmentFilter;
}
}
を考えると?
ありがとうございます。 「その他」の回答は、同様にあなたのものでした。私はそれをコンパイルするために、それを編集した;-) –