NeoKolors.Settings 0.25.30

There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package NeoKolors.Settings --version 0.25.30
                    
NuGet\Install-Package NeoKolors.Settings -Version 0.25.30
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="NeoKolors.Settings" Version="0.25.30" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="NeoKolors.Settings" Version="0.25.30" />
                    
Directory.Packages.props
<PackageReference Include="NeoKolors.Settings" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add NeoKolors.Settings --version 0.25.30
                    
#r "nuget: NeoKolors.Settings, 0.25.30"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package NeoKolors.Settings@0.25.30
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=NeoKolors.Settings&version=0.25.30
                    
Install as a Cake Addin
#tool nuget:?package=NeoKolors.Settings&version=0.25.30
                    
Install as a Cake Tool

NeoKolors.Settings

Build Status Test Status NuGet Version NuGet Downloads License

This package includes a settings building system for easier automation of instance building and settings communication between different parts of applications.

Usage

This section will explain on an example how the system works step by step.


Example

Let's say you have a class C and you want to create a settings that will output an instance of it. C has an Int32 field value whose allowed values are >= -10 and ⇐ 10.

var builder = SettingsBuidler<C>.Build("c-builder",
    SettingsNode<C>.New("default")
        .Argument("field", Arguments.Integer(-10, 10))
        .Constructs(context => new C((int)context["field"].Get()))
);

var result = builder.GetResult();

In the example above we created a SettingsBuilder that outputs C. As you can see builder has a SettingsNode inside of the same type. SettingsNode named "default" contains an argument and a result constructor. The argument named "field" is of type integer and its value can range from -10 up to 10 (same as values of C.value). The result constructor is a Func<Context, TResult> (in our case TResult is C) that uses the constructor of C and Context to output a new instance with the value field set.


SettingsNode

Settings node can have arguments, and groups. You have already seen the creation of a single argument (more types in the Arguments section). SettingsBuilders can contain more than just one SettingsNode. You can have how many SettingsNodes as you want, but too many nodes can result in confusion. Instead of a large amount of nodes with very similar inputs you can create a group and let the user decide which type of input they want to use (example in the SettingsGroup section).


Arguments

As of now NeoKolors.Settings contains 8 argument types all stored in Argument directory.

The types contain:

All these basic arguments can be created using factory methods from Arguments.cs


SettingsGroup

Groups are a way to let the user decide how to input a set of values into the settings.

An example could be authentication:

class Auth
{
    public string Name { get; }
    public string Passcode { get; }
    
    public Auth(string name, string passcode) 
    {
        Name = name;
        Passcode = passcode;
    }
}

var builder = SettingsBuilder<Auth>.Build("auth",
    SettingsNode<Auth>.New("default")
        .Argument("name", Arguments.String())
        .Group(SettingsGroup
            .New("passcode", 
                ("passcode", Arguments.String()))
            .Option(SettingsGroupOption
                .New("pin")
                .Argument("pin", Arguments.Int(0, 9999))
                .Merges((cin, cout) => 
                {
                    cout["passcode"] <<= cin["pin"].Get().ToString();
                })
            )
            .Option(SettingsGroupOption
                .New("password")
                .Argument("password", Arguments.String())
                .Merges((cin, cout) => 
                {
                    cout["passcode"] <<= cin["password"].Get();
                })
            )
            .EnableAutoMerge()
        )
        .Constructs(context => 
        {
            return new Auth((string)context["name"].Get(), (string)context["passcode"].Get());
        })
);

As you can see we created a group named passcode that contains two options, pin and password, that are then merged to the group context from where it is automatically merged to the node's context.

When creating custom arguments or any other structure you can use the inner exceptions using the Exceptions class containing factory methods for those exceptions

Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  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 is compatible.  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.  net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
2026.4.0-preview.4 53 11/15/2026
2026.4.0-preview.3 64 11/1/2026
2026.4.0-preview.2 65 10/30/2026
2026.4.0-preview.1 71 10/23/2026
0.25.30 146 6/8/2026
0.25.4.3 313 1/24/2025
0.25.4.2 190 1/23/2025
0.25.4.1 189 1/22/2025
0.25.4 177 1/22/2025
0.25.3.1 180 1/19/2025