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