Primitively Primitively
Primitively Primitively
DocFX + Singulink = ♥

Search Results for

    Class ByteAttribute

    This attribute should be used on a partial record struct to source generate a Primitively IByte type that encapsulates a byte value.

    Inheritance
    object
    Attribute
    PrimitiveAttribute
    NumericAttribute
    ByteAttribute
    Inherited Members
    PrimitiveAttribute.ImplementIValidatableObject
    Namespace: Primitively
    Assembly: Primitively.Abstractions.dll
    Syntax
    [AttributeUsage(AttributeTargets.Struct, Inherited = false, AllowMultiple = false)]
    public sealed class ByteAttribute : NumericAttribute
    Remarks

    The generated Primitively type will enforce the specified minimum and maximum value constraints.

    Examples

    These examples show how to use the Byte attribute to source generate a Primitively IByte type.

    [Byte]
    public partial record struct Example;
    
    [Byte(Minimum = 1)]
    public partial record struct Example;
    
    [Byte(Minimum = 1, Maximum = 100)]
    public partial record struct Example;

    Properties

    Maximum

    Gets or sets the maximum value supported by the source generated Primitively IByte type.

    Declaration
    public byte Maximum { get; set; }
    Property Value
    Type Description
    byte

    The default value is 255. An assigned value should not be less than the Minimum value.

    Minimum

    Gets or sets the minimum value supported by the source generated Primitively IByte type.

    Declaration
    public byte Minimum { get; set; }
    Property Value
    Type Description
    byte

    The default value is 0. An assigned value should not be greater than the Maximum value.

    © Electronic Hands. All rights reserved.