RobThree / IdGen

Twitter Snowflake-alike ID generator for .Net
MIT License
1.19k stars 148 forks source link

IdGenerator does not contain a definition for 'Take' #50

Closed Fitmavincent closed 1 year ago

Fitmavincent commented 1 year ago

In the documentation, it shows that the generator can create specified numbers of Ids by using generator.Take(100). However the .NET compiler throws an error "Compilation error (line 10, col 28): 'IdGenerator' does not contain a definition for 'Take' and no accessible extension method 'Take'..."

using System;
using IdGen;

public class Program
{
    public static void Main()
    {
        Console.WriteLine("Hello World");
        var generator = new IdGenerator(0);
               var id = generator.Take(100);

    }
}
Compilation error (line 10, col 28): 'IdGenerator' does not contain a definition for 'Take' and no accessible extension method 'Take' accepting a first argument of type 'IdGenerator' could be found (are you missing a using directive or an assembly reference?)
RobThree commented 1 year ago

You need to add a using System.Linq since Take() is a Linq extension method. I thought that would be quote obvious since it's a well-known Linq method.