Created
May 15, 2020 12:42
-
-
Save alistairjevans/4f77e82239312bc48bd18fad5b5c8420 to your computer and use it in GitHub Desktop.
Default parameters on interfaces.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Default arguments in interfaces. | |
// If you call the interface method, the passed value will be "interface". | |
// If you call the object method, the passed value will be "method". | |
// Should the compiler error? | |
public interface IPipelineBuilder | |
{ | |
void AddStage(IPipelineStage stage, string mode = "interface"); | |
} | |
public class PipelineBuilder : IPipelineBuilder | |
{ | |
public void AddStage(IPipelineStage stage, string mode = "method") | |
{ | |
// Do something | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment