c# - Optional parameters on delegates doesn't work properly -
this question has answer here:
- can delegate have optional parameter? 2 answers
why piece of code not compile?
delegate int xxx(bool x = true); xxx test = f; int f() { return 4; }
optional parameters use on calling side - not on single-method-interface implementation. example, should compile:
delegate void simpledelegate(bool x = true); static void main() { simpledelegate x = foo; x(); // print "true" } static void foo(bool y) { console.writeline(y); }
Comments
Post a Comment