-
-
Save jonfuller/511437 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class LineBuilder | |
{ | |
List<LineItem> _lines; | |
public LineBuilder WithLine(params string[] names) | |
{ | |
_lines.AddRange(names.Select(name => new LineItem(name))); | |
return this; | |
} | |
public LineBuilder WithDepLine(object dependency, object target, params string[] names) | |
{ | |
_lines.AddRange(names.Select(name => new DLineItem(dependency, target, name))); | |
return this; | |
} | |
public IEnumerable<LineItem> Lines { get { return _lines; } } | |
} |
This file contains hidden or 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
var result = obj.createResult(resultType, new LineBuilder() | |
.WithLine("A") | |
.WithLine("B") | |
.WithDepLine(dependency, target, "C", "D", "E") | |
.WithLine("F") | |
.Lines); | |
return result; | |
// or this: | |
var result = obj.createResult(resultType, new LineBuilder() | |
.WithLine("A", "B") | |
.WithDepLine(dependency, target, "C", "D", "E") | |
.WithLine("F") | |
.Lines); | |
return result; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment