Show / Hide Table of Contents

    Class Uuid

    Represents a generic, immutable UUID that is binary compatible with Guid.

    The generation of UUIDs of all supported versions is thread-safe. Additionally, generation is lock-free with the exception of one-time initialisation of resources.

    Inheritance
    ValueType
    Uuid
    Implements
    IComparable
    System.IComparable<Uuid>
    System.IEquatable<Uuid>
    IFormattable
    Namespace: XploRe.Util
    Assembly: XploRe.Util.Uuid.dll
    Syntax
    public sealed class Uuid : ValueType, IComparable, IComparable<Uuid>, IEquatable<Uuid>, IFormattable
    Remarks
    Instead of extending Guid, this implementation provides high-performance operations on the internal components of the UUID that are not exposed by Guid and would otherwise require the allocation of a byte array for most operations. Due to binary compatibility with Guid, a Uuid can be marshalled into a Guid and vice-versa.

    Constructors

    Name Description
    Uuid(Byte[]) Initialises a new Uuid instance with the provided bytes. Bytes are expected in little-endian byte order for drop-in compatibility with Guid(Byte[]).
    Uuid(Byte[], ByteOrder) Initialises a new Uuid instance with the provided bytes.
    Uuid(Int32, Int16, Int16, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte) Initialises a new Uuid instance with the provided integers and bytes.
    Uuid(Int32, Int16, Int16, Byte[]) Initialises a new Uuid instance with the provided integers and bytes.
    Uuid(String) Initialises a new Uuid instance with the value represented by the provided string.
    Uuid(UInt32, UInt16, UInt16, Byte, Byte, Byte, Byte, Byte, Byte, Byte, Byte) Initialises a new Uuid instance with the provided integers and bytes.
    Uuid(UInt32, UInt16, UInt16, Byte[]) Initialises a new Uuid instance with the provided integers and bytes.

    Fields

    Name Description
    DnsNamespace DNS namespace name-based UUIDs as defined by RFC 4122.
    Empty Empty Uuid instance whose bits are all set to zero.
    OidNamespace OID namespace name-based UUIDs as defined by RFC 4122.
    UrlNamespace URL namespace name-based UUIDs as defined by RFC 4122.
    X500Namespace X.500 namespace name-based UUIDs as defined by RFC 4122.

    Properties

    Name Description
    IsEmpty Determines whether the UUID is empty, i.e. equal to the Empty instance with all bits set to zero.
    Urn Uniform resource name (URN) for this Uuid.
    Variant The variant of the UUID represented by this instance.
    VariantByteOrder Yields the regular byte order of the UUID for storage and transmission depending on the variant flag.
    Version The version of the UUID represented by this instance. Only meaningful if the variant is Rfc4122. May yield a version that is not defined by UuidVersion for future expansion (the numeric value always corresponds to the embedded version number).

    Methods

    Name Description
    CompareTo(Object) Compares this Uuid instance with another Uuid instance and returns an integer value that indicates whether this instance precedes, follows, or occurs at the same position in the sort order as the other instance.
    CompareTo(Uuid) Compares this Uuid instance with another Uuid instance and returns an integer value that indicates whether this instance precedes, follows, or occurs at the same position in the sort order as the other instance.
    Equals(Object) Indicates whether this Uuid instance is equal to another Uuid instance.
    Equals(Uuid) Indicates whether this Uuid instance is equal to another Uuid instance.
    GetHashCode() Returns the hash code for this instance. The hash code is equal to the hash code returned by GetHashCode() for the same UUID and depends on the .NET runtime.
    NewNameBasedV3(Uuid, Byte[]) Returns a new Uuid version 3 (RFC 4122 variant) instance with a name-based value, created from the MD5 hash of a given namespace UUID and an arbitrary name byte array.

    The same namespace and name combination will always yield the same UUID.

    NewNameBasedV3(Uuid, String) Returns a new Uuid version 3 (RFC 4122 variant) instance with a name-based value, created from the MD5 hash of a given namespace UUID and an arbitrary name string.

    The same namespace and name combination will always yield the same UUID.

    NewNameBasedV5(Uuid, Byte[]) Returns a new Uuid version 5 (RFC 4122 variant) instance with a name-based value, created from the SHA-1 hash of a given namespace UUID and an arbitrary name byte array.

    The same namespace and name combination will always yield the same UUID.

    NewNameBasedV5(Uuid, String) Returns a new Uuid version 5 (RFC 4122 variant) instance with a name-based value, created from the SHA-1 hash of a given namespace UUID and an arbitrary name string.

    The same namespace and name combination will always yield the same UUID.

    NewRandom() Returns a new Uuid version 4 (RFC 4122 variant) instance with a random value, based on a cryptographically strong sequence of random bytes, utilising the default system-wide configured RandomNumberGenerator.
    NewTimeBased() Returns a new Uuid version 1 (RFC 4122 variant) instance with a time-based value, created using a 48-bit node ID (randomly generated), a 60-bit timestamp in 100 ns intervalls since the Gregorian calendar was adopted, and a 14-bit clock sequence that is randomly generated per process/thread.
    ToByteArray() Returns a 16-element byte array that contains the UUID in little-endian byte order. The byte-order is identical to the byte array returned by ToByteArray() for drop-in compatibility. If interoperability with other platforms is required, network byte order should be used for transmission and storage of UUIDs, which is achieved by instead using ToByteArray(ByteOrder) with the BigEndian argument.
    ToByteArray(ByteOrder) Returns a 16-element byte array that contains the UUID.
    ToGuid() Returns a new Guid instance that represents the same UUID.
    ToString() Returns a string representation of the UUID in registry format.
    ToString(String) Returns a string representation of the UUID according to the provided format specifier.

    See documentation on ToString(String) for details on the format specifiers.

    ToString(String, IFormatProvider) Returns a string representation of the UUID according to the provided format specifier and culture-specific format information.

    Operators

    Name Description
    Equality(Guid, Uuid) Tests whether a Guid instance and a Uuid instance are equal.
    Equality(Uuid, Guid) Tests whether a Uuid instance and a Guid instance are equal.
    Equality(Uuid, Uuid) Tests whether two Uuid instances are equal.
    Explicit(String to Uuid) Yields a Uuid instance that represents the textual UUID.
    GreaterThan(Uuid, Uuid) Determines whether an Uuid instance follows another Uuid instance in the sort order.
    GreaterThanOrEqual(Uuid, Uuid) Determines whether an Uuid instance follows or occurs at the same position as another Uuid instance in the sort order.
    Implicit(Guid to Uuid) Yields a Uuid instance that represents the same GUID.
    Implicit(Uuid to Guid) Yields a Guid instance that represents the same UUID.
    Inequality(Guid, Uuid) Tests whether a Guid instance and a Uuid instance are not equal.
    Inequality(Uuid, Guid) Tests whether a Uuid instance and a Guid instance are not equal.
    Inequality(Uuid, Uuid) Tests whether two Uuid instances are not equal.
    LessThan(Uuid, Uuid) Determines whether an Uuid instance precedes another Uuid instance in the sort order.
    LessThanOrEqual(Uuid, Uuid) Determines whether an Uuid instance precedes or occurs at the same position as another Uuid instance in the sort order.
    Back to top Copyright © 2017-2018, xplo.re IT Services, Michael Maier. All rights reserved.