diff --git a/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs b/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs index f035919..56ff02a 100644 --- a/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs +++ b/C#.NET/source/Yitter.IdGenerator/DefaultIdGenerator.cs @@ -40,15 +40,14 @@ namespace Yitter.IdGenerator throw new ApplicationException("BaseTime error."); } - if (options.SeqBitLength + options.WorkerIdBitLength > 22) - { - throw new ApplicationException("error:WorkerIdBitLength + SeqBitLength <= 22"); - } - if (options.WorkerIdBitLength <= 0) { throw new ApplicationException("WorkerIdBitLength error.(range:[1, 21])"); } + if (options.SeqBitLength + options.WorkerIdBitLength > 22) + { + throw new ApplicationException("error:WorkerIdBitLength + SeqBitLength <= 22"); + } var maxWorkerIdNumber = Math.Pow(2, options.WorkerIdBitLength) - 1; if (options.WorkerId < 0 || options.WorkerId > maxWorkerIdNumber)