Quote:
the type Worker already contains a definition for nthNumber
And indeed it does: one at the top of the file:
public class Worker
{
private readonly int nthNumber;
public Worker(int nthNumber) => this.nthNumber = nthNumber;
And one nearer the bottom:
private static int numberOfWorkers = 0;
private readonly int nthNumber;
public Worker()
{
Interlocked.Increment(ref numberOfWorkers);
this.nthNumber = nthNumber;
}
And your parameterless constructor is useless, as it assigns the value of
nthNumber
to itself. Since the method does not define a local or parameter variable called
nthNumber
it means that
this.nthNumber
and
nthNumber
are the same variable.