Swevo.AutoGuard
1.0.1
Prefix Reserved
dotnet add package Swevo.AutoGuard --version 1.0.1
NuGet\Install-Package Swevo.AutoGuard -Version 1.0.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="Swevo.AutoGuard" Version="1.0.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Swevo.AutoGuard" Version="1.0.1" />
<PackageReference Include="Swevo.AutoGuard" />
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 Swevo.AutoGuard --version 1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Swevo.AutoGuard, 1.0.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.
#:package Swevo.AutoGuard@1.0.1
#: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=Swevo.AutoGuard&version=1.0.1
#tool nuget:?package=Swevo.AutoGuard&version=1.0.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Swevo.AutoGuard
Compile-time guard clauses for .NET.
Apply [AutoGuard] to a partial class with a primary constructor, then decorate constructor parameters with guard attributes:
using AutoGuard;
[AutoGuard]
public partial class CreateOrderCommand(
[NotNull] string id,
[NotEmpty] string customer,
[InRange(1, 100)] int quantity,
[Matches(@"^[A-Z0-9]+$")] string sku)
{
}
The source generator emits a private field initializer that validates arguments during construction and throws the expected framework exceptions.
Guard attributes
[NotNull][NotEmpty]forstringandIEnumerable<T>[InRange(min, max)][Matches(pattern)]
Package
- Package ID:
Swevo.AutoGuard - Target: Roslyn source generator / analyzer package
- Assembly packed to
analyzers/dotnet/cs
There are no supported framework assets in this package.
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- 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.