Skip to main content
net7.0

The primary purpose of Dybal.Utils.TypedValues is to avoid mismatch simple values. Such as int, guid, string. And easy to create types with validations.

Published
Jul 12, 2023
3y ago
Total Downloads
1.2K
1,194

Install

dotnet add package Dybal.Utils.TypedValues --version 1.0.0-pre-07
ProductVersions
.NET
net7.0

README

Dybal.Utils.TypedValues

The primary purpose of Dybal.Utils.TypedValues is to avoid mismatch simple values. Such as int, guid, string. And easy to create types with validations.

using Dybal.Utils.TypedValues;

[TypedValue<string>]
public readonly partial record struct Firstname;

[TypedValue<string>]
public readonly partial record struct Lastname;

public record Person(Firstname Firstname, Lastname Lastname);

public class Usage
{
    public Usage()
    {
        var person = new Person(new Firstname("Martin"), new Lastname("Dybal"));
    }
}

Validation of value

[TypedValue<double>]
public readonly partial record struct Percentage
{
    static partial void ValidateValue(double value)
    {
        Guard.Argument(value).GreaterThanOrEqualTo(0).LessThanOrEqualTo(100);
    }
}

Changes from Previous Version

v1.0.0-pre-03v1.0.0-pre-07
Added Frameworks
net7.0
Removed Frameworks
net6.0

Adoption Assessment

Assess this package against its supported frameworks, license, maintenance signals and dependency graph before making it a project standard.

This version is marked prerelease. Validate its API and upgrade path before production use.Compatibility metadata lists 1 target framework; confirm the exact target used by your application.

Related Guides & Workflows

Learn how to evaluate, integrate, or audit this package in your .NET project.