Parameterize.Net 1.2.1

There is a newer version of this package available.
See the version list below for details.
dotnet add package Parameterize.Net --version 1.2.1
NuGet\Install-Package Parameterize.Net -Version 1.2.1
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="Parameterize.Net" Version="1.2.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Parameterize.Net --version 1.2.1
#r "nuget: Parameterize.Net, 1.2.1"
#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.
// Install Parameterize.Net as a Cake Addin
#addin nuget:?package=Parameterize.Net&version=1.2.1

// Install Parameterize.Net as a Cake Tool
#tool nuget:?package=Parameterize.Net&version=1.2.1

Parametrize.Net

Parameterize.Net is a library that allows developers to represent complex objects using float arrays.

Todo

  • Documentation and code comments
  • Allow for float array "parameters".
  • More flexible constraint definition
  • Implementing multitasking where possible.

Installation

Nuget

Usage

[Parameterized]
class PetStore
{
    string name;
    // 2 to 10 animals
    [Parameter(2, 10)]
    public List<Animal> Animals { get; set; }
    [OnInitFunction] // will be called if this is the root object (the main type being created) 
    public void OnInit(string name)
    {
        this.name = name;
        Console.WriteLine($"Name = {name}");
    }
}
[Parameterized]
abstract class Animal
{
    //weight is 5 to 45 with 1 decimal point
    [Parameter(5, 45, 1)]

    public float Weight { get; set; }
    public override string ToString()
    {
        return $"Animal weighing {Weight} Kg ";
    }
}
[Parameterized]
class Dog : Animal
{
    //1 to 10 spots (int)
    [Parameter(1, 10)]
    public int Spots { get; set; }
    [OnInitFunction] // will be called whenever the library creates this type of object
    public void DogInit()
    {
        //pet
    }

    public override string ToString()
    {
        return base.ToString() + $"Dog with {Spots} spots ";
    }
}
[Parameterized]
class Cat : Animal
{
    // 6 to 9 lives
    [Parameter(6, 9)]
    public int Lives { get; set; }
    public override string ToString()
    {
        return base.ToString() + $"Cat with {Lives} lives ";
    }
}


class Program
{
    static void Main(string[] args)
    {
        // Config allow changing constraints in real time
        dynamic config = Parameterizer.GetConfigFor(typeof(PetStore));
        // Change how many objects in a parameterized object collection
        config.Animals.CountConstraint = new Constraint(1,2);
        // Change the constraint for an object parameter
        config.Animals.Lives = new Constraint(1,5);

        // Get the constraints for the float array.
        var constraints = Parameterizer.GetConstraints<PetStore>(config);

        while (true)
        {
            // Generate random float array according to the constraints

            float[] parameters = Constraint.GetRandom(constraints);
            // Create the object from the parameters                        
            var petstore = Parameterizer.Create<PetStore>(parameters,config,"My PetStore Name"); //The string argument at the end will go to an OnInitFunction in the type PetStore.

            foreach (var animal in petstore.Animals)
            {
                Console.WriteLine(animal);
            }
            Console.ReadLine();
        }
    }
}
Product 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has 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.

Version Downloads Last updated
1.3.0 389 10/12/2021
1.2.1 298 10/11/2021
1.2.0 310 10/11/2021
1.1.3 310 10/11/2021
1.1.2 309 10/10/2021
1.1.1 362 10/10/2021
1.1.0 383 10/10/2021
1.0.0 286 10/10/2021

Updated git repository link