Primitively Primitively
Primitively Primitively
DocFX + Singulink = ♥

Search Results for

    Class ShortAttribute

    This class can be used on a partial record struct to source generate a Primitively IShort type that encapsulates a short value.

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

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

    Examples

    These examples show how to use the Short attribute to source generate a Primitively IShort type.

    [Short]
    public partial record struct Example;
    
    [Short(Minimum = 0)]
    public partial record struct Example;
    
    [Short(Minimum = -10, Maximum = 10)]
    public partial record struct Example;

    Properties

    Maximum

    Gets or sets the maximum value supported by the source generated Primitively IShort type. The default value is 32,767. An assigned value should not be less than the Minimum value.

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

    The maximum value supported by the source generated Primitively IShort type.

    Minimum

    Gets or sets the minimum value supported by the source generated Primitively IShort type. The default value is -32,768. An assigned value should not be greater than the Maximum value.

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

    The minimum value supported by the source generated Primitively IShort type.

    © Electronic Hands. All rights reserved.