Skip to content

Commit b4982f4

Browse files
committed
Documentation edits.
1 parent f9c9cb5 commit b4982f4

File tree

1 file changed

+23
-9
lines changed

1 file changed

+23
-9
lines changed

README.md

Lines changed: 23 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ The queue class is the generic `DependencyQueue<T>`, which supports simple
3434
creation via its constructor.
3535

3636
```csharp
37-
using var queue = new DependencyQueue<Step>();
37+
using var queue = new DependencyQueue<Foo>();
3838
```
3939

4040
Because the queue class implements `IDisposable`, make sure to guarantee
@@ -67,7 +67,7 @@ item.
6767

6868
```csharp
6969
builder
70-
.NewItem("MyItem", theItem)
70+
.NewItem("MyItem", someValue)
7171
.Enqueue();
7272
```
7373

@@ -77,7 +77,7 @@ item will depend.
7777

7878
```csharp
7979
builder
80-
.NewItem("MyItem", theItem)
80+
.NewItem("MyItem", someValue)
8181
.AddRequires("ThingINeedA", "ThingINeedB") // accepts multiple names
8282
.AddRequires("ThingINeedC") // can use multiple times
8383
.Enqueue();
@@ -91,12 +91,26 @@ names for the item.
9191

9292
```csharp
9393
builder
94-
.NewItem("MyItem", theItem)
94+
.NewItem("MyItem", someValue)
9595
.AddProvides("BigThingIAmPartOf", "MyAlias") // accepts multiple names
9696
.AddProvides("AnotherAlias") // can use multiple times
9797
.Enqueue();
9898
```
9999

100+
The chain of method calls to build and enqueue item may contain any number of
101+
`AddProvides()` and `AddRequires()` invocations in any order. That flexibility
102+
makes the builder pattern appropriate for cases when information about an item
103+
arrives in pieces, such as from user input or from processing a file.
104+
105+
```csharp
106+
builder
107+
.NewItem("MyItem", someValue)
108+
.AddProvides("BigThingIAmPartOf")
109+
.AddRequires("ThingINeed")
110+
// ...and more, in any order...
111+
.Enqueue();
112+
```
113+
100114
`CreateBuilder()` is thread-safe, but the builder object it returns is not. To
101115
build and enqueue items in parallel, create a separate builder for each thread.
102116

@@ -110,9 +124,9 @@ that one call.
110124
```csharp
111125
queue.Enqueue(
112126
name: "MyItem",
113-
value: theItem,
114-
requires: ["ThingINeedA", "ThingINeedB", "ThingINeedC"],
115-
provides: ["BigThingIAmPartOf", "MyAlias", "AnotherAlias"]
127+
value: someValue,
128+
provides: ["BigThingIAmPartOf", "MyAlias", "AnotherAlias"],
129+
requires: ["ThingINeedA", "ThingINeedB", "ThingINeedC"]
116130
);
117131
```
118132

@@ -211,12 +225,12 @@ foreach (var error in errors)
211225
{
212226
switch (error)
213227
{
214-
case DependencyQueueUnprovidedTopicError<Step> unprovided:
228+
case DependencyQueueUnprovidedTopicError<Foo> unprovided:
215229
// Available properties:
216230
_ = unprovided.Topic; // The topic required but not provided
217231
break;
218232

219-
case DependencyQueueCycleError<Step> cycle:
233+
case DependencyQueueCycleError<Foo> cycle:
220234
// Available properties:
221235
_ = cycle.RequiringItem; // The item that caused the cycle
222236
_ = cycle.RequiredTopic; // What it required, causing the cycle

0 commit comments

Comments
 (0)