Uuid80

Namespace: System · struct

Implements: IFormattable, IEquatable<Uuid80>, IComparable<Uuid80>, IEquatable<Slice>, ISliceSerializable, ISpanEncodable, ISpanFormattable, ISpanParsable<Uuid80>, IParsable<Uuid80>, IEquatable<ReadOnlySpan<byte>>

Represents an 80-bit UUID that is stored in high-endian format in the output

Constructors

Uuid80

Uuid80(ushort a, ulong b)

Pack components into an 80-bit UUID

  • aXXXX-........-........
  • b....-XXXXXXXX-XXXXXXXX

Uuid80(ushort a, long b)

Pack components into an 80-bit UUID

  • a — XXXX-........-........
  • b — ....-XXXXXXXX-XXXXXXXX

Uuid80(int a, long b)

Pack components into an 80-bit UUID

  • a — XXXX-........-........
  • b — ....-XXXXXXXX-XXXXXXXX

Uuid80(ushort a, uint b, uint c)

Pack components into an 80-bit UUID

  • a — XXXX-........-........
  • b — ....-XXXXXXXX-........
  • c — ....-........-XXXXXXXX

Uuid80(int a, int b, int c)

Pack components into an 80-bit UUID

  • a — XXXX-........-........
  • b — ....-XXXXXXXX-........
  • c — ....-........-XXXXXXXX

Uuid80(ushort a, ushort b, ushort c, ushort d, ushort e)

Pack components into an 80-bit UUID

  • a — XXXX-........-........
  • b — ....-XXXX....-........
  • c — ....-....XXXX-........
  • d — ....-........-XXXX....
  • e — ....-........-....XXXX

Properties

Lower16

ushort Lower16 { get; }

Returns the 16 lower bits ....-........-....xxxx

Lower32

uint Lower32 { get; }

Returns the 32 lower bits ....-........-xxxxxxxx

Lower48

Uuid48 Lower48 { get; }

Returns the 48 lower bits ....-....xxxx-xxxxxxxx

Lower64

ulong Lower64 { get; }

Returns the 64 lower bits ....-xxxxxxxx-xxxxxxxx

Upper16

uint Upper16 { get; }

Returns the 16 upper bits xxxx-........-........

Upper32

uint Upper32 { get; }

Returns the 32 upper bits xxxx-xxxx....-........

Upper48

Uuid48 Upper48 { get; }

Returns the 48 upper bits xxxx-xxxxxxxx-........

Upper64

ulong Upper64 { get; }

Returns the 64 upper bits xxxx-xxxxxxxx-xxxx....

Methods

CompareTo

int CompareTo(Uuid80 other)

Deconstruct

void Deconstruct(out ushort a, out ulong b)

Split into two fragments

  • a — xxxx-........-........
  • b — ....-xxxxxxxx-xxxxxxxx

void Deconstruct(out ushort a, out uint b, out uint c)

Split into three fragments

  • a — xxxx-........-........
  • b — ....-xxxxxxxx-........
  • c — ....-........-xxxxxxxx

Equals

bool Equals(object obj)

bool Equals(Uuid80 other)

bool Equals(Slice other)

bool Equals(ReadOnlySpan<byte> other)

FromInt128

static Uuid80 FromInt128(Int128 value)

FromInt16

static Uuid80 FromInt16(short value)

FromInt32

static Uuid80 FromInt32(int value)

FromInt48

static Uuid80 FromInt48(long value)

FromInt64

static Uuid80 FromInt64(long value)

FromLower16

static Uuid80 FromLower16(ushort low)

Creates a Uuid80 from the lower 16 bits, with the upper 64 bits all set to 0

  • low — 16 lower bits (....-........-....xxxx)

FromLower32

static Uuid80 FromLower32(uint low)

Creates a Uuid80 from the lower 32 bits, with the upper 48 bits all set to 0

  • low — 32 lower bits (....-........-xxxxxxxx)

FromLower48

static Uuid80 FromLower48(ulong low)

Creates a Uuid80 from the lower 48 bits, with the upper 32 bits all set to 0

  • low — 48 lower bits (....-....xxxx-xxxxxxxx)

The upper 16 bits of will be ignored.

FromLower64

static Uuid80 FromLower64(ulong low)

Creates a Uuid80 from the lower 64 bits, with the upper 16 bits all set to 0

  • low — 64 lower bits (....-xxxxxxxx-xxxxxxxx)

FromUInt128

static Uuid80 FromUInt128(UInt128 value)

FromUInt16

static Uuid80 FromUInt16(ushort value)

FromUInt32

static Uuid80 FromUInt32(uint value)

FromUInt48

static Uuid80 FromUInt48(ulong value)

FromUInt64

static Uuid80 FromUInt64(ulong value)

FromUpper16Lower64

static Uuid80 FromUpper16Lower64(ushort hi, ulong low)

Creates a Uuid80 from the upper 16-bit and lower 64-bit parts

  • hi — 16 upper bits (xxxx-........-........)
  • low — 64 lower bits (....-xxxxxxxx-xxxxxxxx)

FromUpper32Lower48

static Uuid80 FromUpper32Lower48(uint hi, ulong low)

Creates a Uuid80 from the upper 32-bit and lower 48-bit parts

  • hi — 32 upper bits (xxxx-xxxx....-........)
  • low — 48 lower bits (....-....xxxx-xxxxxxxx)

The upper 16 bits of will be ignored.

FromUpper48Lower32

static Uuid80 FromUpper48Lower32(ulong hi, uint low)

Creates a Uuid80 from the upper 48-bit and lower 32-bit parts

  • hi — 48 upper bits (xxxx-xxxxxxxx-........)
  • low — 32 lower bits (....-........-xxxxxxxx)

The upper 16 bits of will be ignored.

FromUpper64Lower16

static Uuid80 FromUpper64Lower16(ulong hi, ushort low)

Creates a Uuid80 from the upper 64-bit and lower 16-bit parts

  • hi — 64 upper bits (xxxx-xxxxxxxx-xxxx....)
  • low — 16 lower bits (....-........-....xxxx)

GetHashCode

int GetHashCode()

NewUuid

static Uuid80 NewUuid()

Generate a new random 80-bit UUID.

If you need sequential or cryptographic uuids, you should use a different generator.

Parse

static Uuid80 Parse(string input)

Parse a string representation of an Uuid80

  • input — String in either formats: "", "xxxx-xxxxxxxx-xxxxxxxx", "xxxxxxxxxxxxxxxxxxxx", "{xxxx-xxxxxxxx-xxxxxxxx}", "{xxxxxxxxxxxxxxxxxxxx}"

Parsing is case-insensitive. The empty string is mapped to Uuid80.Empty.

static Uuid80 Parse(ReadOnlySpan<char> input)

Parse a string representation of an Uuid80

static Uuid80 Parse(string input, IFormatProvider provider)

Parse a string representation of an Uuid80

  • input — String in either formats: "", "xxxx-xxxxxxxx-xxxxxxxx", "xxxxxxxxxxxxxxxxxxxx", "{xxxx-xxxxxxxx-xxxxxxxx}", "{xxxxxxxxxxxxxxxxxxxx}"
  • provider — This parameter is ignored

Parsing is case-insensitive. The empty string is mapped to Uuid80.Empty.

static Uuid80 Parse(ReadOnlySpan<char> input, IFormatProvider provider)

Parse a string representation of an Uuid80

Read

static Uuid80 Read(byte[] value)

Reads an 80-bit UUID from a byte array

  • value — Array of bytes that is either empty, or holds at least 10 bytes

Returns: Corresponding Uuid80 if the read is successful

If value is larger than 10 bytes, the additional bytes will be ignored.

static Uuid80 Read(Slice value)

Reads an 80-bit UUID from slice of memory

  • value — Slice of bytes that is either empty, or holds at least 10 bytes

Returns: Corresponding Uuid80 if the read is successful

If value is larger than 10 bytes, the additional bytes will be ignored.

static Uuid80 Read(ReadOnlySpan<byte> value)

Reads an 80-bit UUID from slice of memory

  • value — Span of bytes that is either empty, or holds at least 10 bytes

Returns: Corresponding Uuid80 if the read is successful

If value is larger than 10 bytes, the additional bytes will be ignored.

ToByteArray

byte[] ToByteArray()

Returns newly allocated array of bytes that represents this UUID

ToInt128

Int128 ToInt128()

Return the equivalent Int128

The integer correspond to the big-endian version of this instance, serialized as a byte array

ToSlice

Slice ToSlice()

Returns a newly allocated Slice that represents this UUID

ToString

string ToString()

Returns a string representation of the value of this instance.

Returns: String using the format "xxxxxxxx-xxxxxxxx", where 'x' is a lower-case hexadecimal digit

Strings returned by this method will always to 17 characters long.

string ToString(string format)

Returns a string representation of the value of this Uuid80 instance, according to the provided format specifier.

  • format — A single format specifier that indicates how to format the value of this Guid. The format parameter can be "D", "B", "X", "G", "Z" or "N". If format is null or an empty string (""), "D" is used.

Returns: The value of this Uuid80, using the specified format.

See for a description of the different formats

string ToString(string format, IFormatProvider formatProvider)

Returns a string representation of the value of this instance of the Uuid80 class, according to the provided format specifier and culture-specific format information.

  • format — A single format specifier that indicates how to format the value of this Guid. The format parameter can be "D", "N", "Z", "R", "X" or "B". If format is null or an empty string (""), "D" is used.
  • formatProvider — An object that supplies culture-specific formatting information. Only used for the "R" format.

Returns: The value of this Uuid80, using the specified format.

The D format encodes the value as three groups of hexadecimal digits, separated by a hyphen: "aaaa-bbbbbbbb-cccccccc" (22 characters).The X and N format encodes the value as a single group of 20 hexadecimal digits: "aaaabbbbbbbbcccccccc" (20 characters).The B format is equivalent to the D format, but surrounded with '{' and '}': "" (24 characters).

ToUInt128

UInt128 ToUInt128()

Return the equivalent UInt128

The integer correspond to the big-endian version of this instance, serialized as a byte array

TryFormat

bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format, IFormatProvider provider = null)

TryParse

static bool TryParse(string input, out Uuid80 result)

Try parsing a string representation of an Uuid80

static bool TryParse(ReadOnlySpan<char> input, out Uuid80 result)

Try parsing a string representation of an Uuid80

static bool TryParse(ReadOnlySpan<byte> utf8Text, out Uuid80 result)

Try parsing a UTF-8 string representation of an Uuid80

static bool TryParse(string input, IFormatProvider provider, out Uuid80 result)

Try parsing a string representation of an Uuid80

static bool TryParse(ReadOnlySpan<char> input, IFormatProvider provider, out Uuid80 result)

Try parsing a string representation of an Uuid80

TryRead

static bool TryRead(byte[] value, out Uuid80 result)

Reads an 80-bit UUID from slice of memory

  • value — Array of bytes that is either empty, or holds at least 10 bytes
  • result — Corresponding Uuid80, if the read is successful

Returns: true if value has length 0 or at least 10; otherwise, false.

If value is larger than 10 bytes, the additional bytes will be ignored.

static bool TryRead(Slice value, out Uuid80 result)

Reads an 80-bit UUID from slice of memory

  • value — Slice of bytes that is either empty, or holds at least 10 bytes
  • result — Corresponding Uuid80, if the read is successful

Returns: true if value has length 0 or at least 10; otherwise, false.

If value is larger than 10 bytes, the additional bytes will be ignored.

static bool TryRead(ReadOnlySpan<byte> value, out Uuid80 result)

Reads an 80-bit UUID from slice of memory

  • value — Span of bytes that is either empty, or holds at least 10 bytes
  • result — Corresponding Uuid80, if the read is successful

Returns: true if value has length 0 or at least 10; otherwise, false.

If value is larger than 10 bytes, the additional bytes will be ignored.

TryWriteTo

bool TryWriteTo(Span<byte> destination)

Writes the bytes of this instance to the specified destination, if it is large enough.

  • destination — Buffer where the bytes will be written to, with a capacity of at least 10 bytes

Returns: true if the destination is large enough; otherwise, false

bool TryWriteTo(Span<byte> destination, out int bytesWritten)

Writes the bytes of this instance to the specified destination, if it is large enough.

  • destination — Buffer where the bytes will be written to, with a capacity of at least 10 bytes
  • bytesWritten — Receives the number of bytes written (either 10 or 0)

Returns: true if the destination is large enough; otherwise, false

WriteTo

void WriteTo(ref SliceWriter writer)

Writes this UUID to the specified writer

void WriteTo(Span<byte> destination)

Fields

AllBitsSet

static readonly Uuid80 AllBitsSet

Uuid80 with all bits set to 1 ("FFFF-FFFFFFFF-FFFFFFFF")

Empty

static readonly Uuid80 Empty

Uuid80 with all bits set to 0 ("0000-00000000-00000000")

MaxValue

static readonly Uuid80 MaxValue

Uuid80 with all bits set to 1 ("FFFF-FFFFFFFF-FFFFFFFF")

MinValue

static readonly Uuid80 MinValue

Uuid80 with all bits set to 0 ("0000-00000000-00000000")

One

static readonly Uuid80 One

Uuid80 with only bit 0 set to 1 ("0000-00000000-00000001")

SizeOf

const int SizeOf

Size is 10 bytes