Help me understand the code snippet in c#
Posted
by Benny
on Stack Overflow
See other posts from Stack Overflow
or by Benny
Published on 2010-04-22T18:36:07Z
Indexed on
2010/04/22
18:43 UTC
Read the original article
Hit count: 200
c#
|code-snippet
I am reading this blog: Pipes and filters pattern
I am confused by this code snippet:
public class Pipeline<T>
{
private readonly List<IOperation<T>> operations = new List<IOperation<T>>();
public Pipeline<T> Register(IOperation<T> operation)
{
operations.Add(operation);
return this;
}
public void Execute()
{
IEnumerable<T> current = new List<T>();
foreach (IOperation<T> operation in operations)
{
current = operation.Execute(current);
}
IEnumerator<T> enumerator = current.GetEnumerator();
while (enumerator.MoveNext());
}
}
what is the purpose of this statement: while (enumerator.MoveNext());? seems this code is a noop.
© Stack Overflow or respective owner