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