Primitively Primitively
Primitively Primitively
DocFX + Singulink = ♥

Search Results for

    Class GuidAttribute

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

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

    These examples show how to use the Guid attribute to source generate a Primitively IGuid type.

    [Guid] // e.g. 2c48c152-7cb7-4f51-8f01-704454f36e60
    public partial record struct Example;
    
    [Guid(Specifier.B)] // e.g. {2c48c152-7cb7-4f51-8f01-704454f36e60}
    public partial record struct Example;
    
    [Guid(Specifier.D)] // e.g. 2c48c152-7cb7-4f51-8f01-704454f36e60 (Default)
    public partial record struct Example;
    
    [Guid(Specifier.N)] // e.g. 2c48c1527cb74f518f01704454f36e60
    public partial record struct Example;
    
    [Guid(Specifier.P)] // e.g. (2c48c152-7cb7-4f51-8f01-704454f36e60)
    public partial record struct Example;
    
    [Guid(Specifier.X)] // e.g. {0x2c48c152,0x7cb7,0x4f51,{0x8f,0x01,0x70,0x44,0x54,0xf3,0x6e,0x60}}
    public partial record struct Example;

    Constructors

    GuidAttribute()

    Initializes a new instance of the GuidAttribute class with the default D specifier.

    Declaration
    public GuidAttribute()

    GuidAttribute(Specifier)

    Initializes a new instance of the GuidAttribute class with the provided specifier.

    Declaration
    public GuidAttribute(Specifier specifier)
    Parameters
    Type Name Description
    Specifier specifier

    The specifier to use when generating the IGuid.

    Properties

    Specifier

    Gets the specifier used to generate the IGuid.

    Declaration
    public Specifier Specifier { get; }
    Property Value
    Type Description
    Specifier

    The default value is D. An assigned value should be one of the Specifier values.

    © Electronic Hands. All rights reserved.