Class IntAttribute
This attribute should be used on a partial record struct
to source generate
a Primitively IInt type that encapsulates an int value.
Inherited Members
Namespace: Primitively
Assembly: Primitively.Abstractions.dll
Syntax
[AttributeUsage(AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
public sealed class IntAttribute : NumericAttribute
Remarks
The generated Primitively type will enforce the specified minimum and maximum value constraints.
Examples
These examples show how to use the Int attribute to source generate a Primitively IInt type.
[Int]
public partial record struct Example;
[Int(Minimum = 0)]
public partial record struct Example;
[Int(Minimum = 1000, Maximum = 2000)]
public partial record struct Example;
Properties
Maximum
Gets or sets the maximum value supported by the source generated Primitively IInt type.
Declaration
public int Maximum { get; set; }
Property Value
Type | Description |
---|---|
int | The default value is 2,147,483,647. An assigned value should not be less than the Minimum value. |
Minimum
Gets or sets the minimum value supported by the source generated Primitively IInt type.
Declaration
public int Minimum { get; set; }
Property Value
Type | Description |
---|---|
int | The default value is -2,147,483,648. An assigned value should not be greater than the Maximum value. |