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
Properties
Guid
Gets/sets the underlying Guid
public Guid Guid { get; set; }
Property Value
Value
Gets/sets the underlying base64 encoded string
public string Value { get; set; }
Property Value
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
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
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
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
GetHashCode()
Returns the HashCode for underlying Guid.
public override int GetHashCode()
Returns
NewGuid()
Initialises a new instance of the ShortGuid class
public static ShortGuid NewGuid()
Returns
ToString()
Returns the base64 encoded guid as a string
public override string ToString()
Returns
Operators
operator ==(ShortGuid, ShortGuid)
Determines if both ShortGuids have the same underlying Guid value.
public static bool operator ==(ShortGuid x, ShortGuid y)
Parameters
Returns
implicit operator string(ShortGuid)
Implicitly converts the ShortGuid to it's string equivilent
public static implicit operator string(ShortGuid shortGuid)
Parameters
shortGuid
ShortGuid
Returns
implicit operator Guid(ShortGuid)
Implicitly converts the ShortGuid to it's Guid equivilent
public static implicit operator Guid(ShortGuid shortGuid)
Parameters
shortGuid
ShortGuid
Returns
implicit operator ShortGuid(string)
Implicitly converts the string to a ShortGuid
public static implicit operator ShortGuid(string shortGuid)
Parameters
shortGuid
string
Returns
implicit operator ShortGuid(Guid)
Implicitly converts the Guid to a ShortGuid
public static implicit operator ShortGuid(Guid guid)
Parameters
guid
Guid
Returns
operator !=(ShortGuid, ShortGuid)
Determines if both ShortGuids do not have the same underlying Guid value.
public static bool operator !=(ShortGuid x, ShortGuid y)