Add parameter overload for CakeTaskBuilder.Does.
See original GitHub issueI would to use a pattern like the following to dynamically build tasks.
The problem is that by running .\build.ps1 -target DefaultB
I get an null reference for folder in the does delegate. This is possible through closure, isn’t it?
var folders = new []{"A","B"};
var target = Argument("target","DefaultA");
foreach(var folder in folders)
{
Task("Default"+folder)
.Does(folder =>
{
CreateDirectory(folder);
//something else
});
}
RunTarget(target);
Issue Analytics
- State:
- Created 7 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Conflicting overloaded methods with optional parameters
An overload which doesn't require any optional parameters to be filled in automatically is preferred to one which does.
Read more >Member Overloading - Framework Design Guidelines
In this article. Member overloading means creating two or more members on the same type that differ only in the number or type...
Read more >Overloading
Overloading causes a lot less of a problem when only one method will ever be applicable - for example when the parameter types...
Read more >Overload resolution
In practice, the rules for determining overload resolution are intended to find the overload that is "closest" to the actual arguments ...
Read more >When should method overloads be refactored?
I believe the common approach is to encapsulate some (or all) of the parameters into a class and have that as a parameter:...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I believe the correct way is this:
This is addressed by #1767