Table of Contents

Struct ShortGuid

Namespace: Casewhere.SystemTypes
Assembly: Casewhere.SystemTypes.dll

Represents a globally unique identifier (GUID) with a shorter string value. Sguid

public struct ShortGuid

Inherited Members

object.ToString(), object.Equals(object), object.Equals(object, object), object.ReferenceEquals(object, object), object.GetHashCode(), object.GetType()

Extension Methods

EnumExtensions.DeepClone<ShortGuid>(ShortGuid)

Constructors

ShortGuid(string)

Creates a ShortGuid from a base64 encoded string

public ShortGuid(string value)

Parameters

value string

The encoded guid as a base64 string

ShortGuid(Guid)

Creates a ShortGuid from a Guid

public ShortGuid(Guid guid)

Parameters

guid Guid

The Guid to encode

Fields

Empty

A read-only instance of the ShortGuid class whose value is guaranteed to be all zeroes.

public static readonly ShortGuid Empty

Field Value

ShortGuid

Properties

Guid

Gets/sets the underlying Guid

public Guid Guid { get; set; }

Property Value

Guid

Value

Gets/sets the underlying base64 encoded string

public string Value { get; set; }

Property Value

string

Methods

Decode(string)

Decodes the given base64 string

public static Guid Decode(string value)

Parameters

value string

The base64 encoded string of a Guid

Returns

Guid

A new Guid

Encode(string)

Creates a new instance of a Guid using the string value, then returns the base64 encoded version of the Guid.

public static string Encode(string value)

Parameters

value string

An actual Guid string (i.e. not a ShortGuid)

Returns

string

Encode(Guid)

Encodes the given Guid as a base64 string that is 22 characters long.

public static string Encode(Guid guid)

Parameters

guid Guid

The Guid to encode

Returns

string

Equals(object)

Returns a value indicating whether this instance and a specified Object represent the same type and value.

public override bool Equals(object obj)

Parameters

obj object

The object to compare

Returns

bool

GetHashCode()

Returns the HashCode for underlying Guid.

public override int GetHashCode()

Returns

int

NewGuid()

Initialises a new instance of the ShortGuid class

public static ShortGuid NewGuid()

Returns

ShortGuid

ToString()

Returns the base64 encoded guid as a string

public override string ToString()

Returns

string

Operators

operator ==(ShortGuid, ShortGuid)

Determines if both ShortGuids have the same underlying Guid value.

public static bool operator ==(ShortGuid x, ShortGuid y)

Parameters

x ShortGuid

y ShortGuid

Returns

bool

implicit operator string(ShortGuid)

Implicitly converts the ShortGuid to it's string equivilent

public static implicit operator string(ShortGuid shortGuid)

Parameters

shortGuid ShortGuid

Returns

string

implicit operator Guid(ShortGuid)

Implicitly converts the ShortGuid to it's Guid equivilent

public static implicit operator Guid(ShortGuid shortGuid)

Parameters

shortGuid ShortGuid

Returns

Guid

implicit operator ShortGuid(string)

Implicitly converts the string to a ShortGuid

public static implicit operator ShortGuid(string shortGuid)

Parameters

shortGuid string

Returns

ShortGuid

implicit operator ShortGuid(Guid)

Implicitly converts the Guid to a ShortGuid

public static implicit operator ShortGuid(Guid guid)

Parameters

guid Guid

Returns

ShortGuid

operator !=(ShortGuid, ShortGuid)

Determines if both ShortGuids do not have the same underlying Guid value.

public static bool operator !=(ShortGuid x, ShortGuid y)

Parameters

x ShortGuid

y ShortGuid

Returns

bool