|
|
|
|
|
by kevingadd
700 days ago
|
|
In general, problems that some languages would solve with an interface containing 1-2 methods can be solved simply via delegates in C#. Then you can bind to any method with a compatible signature, or to an anonymous closure, or to a local function, without any fuss. Compared to the bad old days of having to write a whole anonymous class in java, it's pretty straightforward. Thankfully things like ValueTuple are built-in now alongside ref/out parameters, so producing multiple return values is no problem. The downside is usually a method with a compatible signature doesn't have compatible behavior. This is part of why explicit interfaces are still valuable. |
|