C# Class NetworkCommsDotNet.Tools.ShortGuid

Represents a shortform globally unique identifier (GUID) which is easier to handle than Guid.NewGuid(). This class is used to uniquely identify a peer/application using NetworkComms.Net. See here for original source.
Show file Open project: MarcFletcher/NetworkComms.Net Class Usage Examples

Public Properties

Property Type Description
Empty ShortGuid

Public Methods

Method Description
Decode ( string value ) : System.Guid

Decodes the given base64 string

Encode ( System.Guid guid ) : string

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

Encode ( string value ) : string

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

Equals ( object obj ) : bool

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

GetHashCode ( ) : int

Returns the HashCode for underlying Guid.

NewGuid ( ) : ShortGuid

Initialises a new instance of the ShortGuid class

ShortGuid ( System.Guid guid ) : System

Creates a ShortGuid from a Guid

ShortGuid ( string value ) : System

Creates a ShortGuid from a base64 encoded string

ToString ( ) : string

Returns the base64 encoded guid as a string

operator ( ) : bool

Determines if both ShortGuids have the same underlying Guid value.

Method Details

Decode() public static method

Decodes the given base64 string
public static Decode ( string value ) : System.Guid
value string The base64 encoded string of a Guid
return System.Guid

Encode() public static method

Encodes the given Guid as a base64 string that is 22 characters long.
public static Encode ( System.Guid guid ) : string
guid System.Guid The Guid to encode
return string

Encode() public static method

Creates a new instance of a Guid using the string value, then returns the base64 encoded version of the Guid.
public static Encode ( string value ) : string
value string An actual Guid string (i.e. not a ShortGuid)
return string

Equals() public method

Returns a value indicating whether this instance and a specified Object represent the same type and value.
public Equals ( object obj ) : bool
obj object The object to compare
return bool

GetHashCode() public method

Returns the HashCode for underlying Guid.
public GetHashCode ( ) : int
return int

NewGuid() public static method

Initialises a new instance of the ShortGuid class
public static NewGuid ( ) : ShortGuid
return ShortGuid

ShortGuid() public method

Creates a ShortGuid from a Guid
public ShortGuid ( System.Guid guid ) : System
guid System.Guid The Guid to encode
return System

ShortGuid() public method

Creates a ShortGuid from a base64 encoded string
public ShortGuid ( string value ) : System
value string The encoded guid as a /// base64 string
return System

ToString() public method

Returns the base64 encoded guid as a string
public ToString ( ) : string
return string

operator() public static method

Determines if both ShortGuids have the same underlying Guid value.
public static operator ( ) : bool
return bool

Property Details

Empty public static property

A read-only instance of the ShortGuid class whose value is guaranteed to be all zeroes.
public static ShortGuid,NetworkCommsDotNet.Tools Empty
return ShortGuid