@@ -97,9 +97,9 @@ public PipelineBuilder<TInput, TNewOutput> LinkTo<TNewOutput>(
97
97
{
98
98
if ( block == null ) throw new ArgumentNullException ( nameof ( block ) ) ;
99
99
var source = _source ;
100
- var action = new LinkDelegate ( completions
101
- => PipelineCommon . LinkTo ( source , block , completions ) ) ;
102
- var newActions = PipelineUtilities . Append ( _linkDelegates , action ) ;
100
+ var action = new LinkDelegate (
101
+ completions => PipelineCommon . LinkTo ( source , block , completions ) ) ;
102
+ var newActions = PipelineCommon . Append ( _linkDelegates , action ) ;
103
103
return new PipelineBuilder < TInput , TNewOutput > ( _target , block , newActions ) ;
104
104
}
105
105
@@ -112,9 +112,9 @@ public PipelineBuilder<TInput> LinkTo(ITargetBlock<TOutput> block)
112
112
{
113
113
if ( block == null ) throw new ArgumentNullException ( nameof ( block ) ) ;
114
114
var source = _source ;
115
- var action = new LinkDelegate ( completions
116
- => PipelineCommon . LinkTo ( source , block , completions ) ) ;
117
- var newActions = PipelineUtilities . Append ( _linkDelegates , action ) ;
115
+ var action = new LinkDelegate (
116
+ completions => PipelineCommon . LinkTo ( source , block , completions ) ) ;
117
+ var newActions = PipelineCommon . Append ( _linkDelegates , action ) ;
118
118
return new PipelineBuilder < TInput > ( _target , newActions ) ;
119
119
}
120
120
@@ -176,6 +176,7 @@ internal static void LinkTo<TOutput>(
176
176
// internally by the TPL Dataflow library. The ContinueWith method is used for
177
177
// creating fire-and-forget continuations, with any error thown inside the
178
178
// continuations propagated to the ThreadPool.
179
+ // https://source.dot.net/System.Threading.Tasks.Dataflow/Internal/Common.cs.html#7160be0ba468d387
179
180
// It's extremely unlikely that any of these continuations will ever fail since,
180
181
// according to the documentation, the invoked APIs do not throw exceptions.
181
182
@@ -207,6 +208,22 @@ internal static void OnErrorThrowOnThreadPool(Action action)
207
208
ThreadPool . QueueUserWorkItem ( state => { ( ( ExceptionDispatchInfo ) state ) . Throw ( ) ; } , edi ) ;
208
209
}
209
210
}
211
+
212
+ internal static T [ ] Append < T > ( T [ ] array , T item )
213
+ {
214
+ T [ ] newArray ;
215
+ if ( array == null || array . Length == 0 )
216
+ {
217
+ newArray = new T [ 1 ] ;
218
+ }
219
+ else
220
+ {
221
+ newArray = new T [ array . Length + 1 ] ;
222
+ Array . Copy ( array , newArray , array . Length ) ;
223
+ }
224
+ newArray [ newArray . Length - 1 ] = item ;
225
+ return newArray ;
226
+ }
210
227
}
211
228
212
229
internal class Pipeline < TInput > : ITargetBlock < TInput >
@@ -282,23 +299,4 @@ public bool TryReceiveAll(out IList<TOutput> items)
282
299
return false ;
283
300
}
284
301
}
285
-
286
- internal static class PipelineUtilities
287
- {
288
- internal static T [ ] Append < T > ( T [ ] array , T item )
289
- {
290
- T [ ] newArray ;
291
- if ( array == null || array . Length == 0 )
292
- {
293
- newArray = new T [ 1 ] ;
294
- }
295
- else
296
- {
297
- newArray = new T [ array . Length + 1 ] ;
298
- Array . Copy ( array , newArray , array . Length ) ;
299
- }
300
- newArray [ newArray . Length - 1 ] = item ;
301
- return newArray ;
302
- }
303
- }
304
302
}
0 commit comments