ElvenNameGenerator 1.0.0
dotnet add package ElvenNameGenerator --version 1.0.0
NuGet\Install-Package ElvenNameGenerator -Version 1.0.0
<PackageReference Include="ElvenNameGenerator" Version="1.0.0" />
paket add ElvenNameGenerator --version 1.0.0
#r "nuget: ElvenNameGenerator, 1.0.0"
// Install ElvenNameGenerator as a Cake Addin
#addin nuget:?package=ElvenNameGenerator&version=1.0.0
// Install ElvenNameGenerator as a Cake Tool
#tool nuget:?package=ElvenNameGenerator&version=1.0.0
ElvenNameGenerator
A simple C# code that generates random elvish names.
As a developer, whenever test data needed for people names, I create a similiar solution to this one that generates some random names. Using some elven names made it culture invariant and sort of fun.
A quick google search for elven names revealed the following nice site. Inspired by the method presented and using the prefixes and suffixes listed there, I implemented a simple class to randomly pick full elven names.
Feel free to submit feature requests, bug reports, issues and pull requests.
Usage
Generate a random name
var generator = new ElvenNameGenerator();
var name = generator.GenerateName();
Generate random 10 full names
var generator = new ElvenNameGenerator();
var fullnames = generator.GenerateFullName().Take(10);
Generate random 100 full names with fixed seed
// When you specify a seed, you'll get the same sequence with the same seed value
var generator = new ElvenNameGenerator(42);
var fullnames = generator.GenerateFullName().Take(100);
Dependency injection
Use IElvenNameGenerator
interface for DI in your own implementation.
using System;
using System.Collections.Generic;
using System.Linq;
namespace ElvenNameGenerator.Tests
{
public class SampleClass
{
private readonly IElvenNameGenerator _elvenNameGenerator;
public SampleClass(IElvenNameGenerator elvenNameGenerator)
{
_elvenNameGenerator = elvenNameGenerator;
// Fix randomization to same sequence of names
_elvenNameGenerator.Seed(42);
}
public IEnumerable<string> GenerateSameElvenNames(int count) =>
_elvenNameGenerator.GenerateFullName().Take(count);
public IEnumerable<string> GenerateDifferentElvenNames(int count)
{
_elvenNameGenerator.Seed(new Random().Next());
return _elvenNameGenerator.GenerateFullName().Take(count);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.1 is compatible. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.1
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
* Introduced an interface for DI needs.
* Updated dependencies to latest dotnet standard.