codeyu/nanoid-net

`using Nanoid;` won't work

aradalvand opened this issue · 2 comments

Hi there. First off, thank you for this package.

It seems like it's not possible to do a using Nanoid; at the top of a .cs file and then reference the Nanoid class in the code. Later Nanoid references point to the namespace and not the class:

using Nanoid;

string id = Nanoid.Generate(); // ERROR: "The type or namespace name 'GenerateAsync' does not exist in the namespace 'Nanoid'"

image

Minimal repro: https://github.com/aradalvand/nanoid-namespace-test

Having a type with the same name as its containing namespace is officially considered bad practice. More importantly in this case, it's basically unusable. You always have to use a fully-qualified name, which is ugly (e.g. Nanoid.Nanoid.Generate())

Please consider changing the name of the namespace to something else, for example, NanoidNs, NanoidGenerator or anything that would make it different from the class name.

Please use version 3.0.0, thank you.

Thanks, but I think it would've made more sense to keep the namespace as Nanoid so that it matches the NuGet package name and instead change the class name to something like NanoidGenerator.