SequoiaDB
 All Classes Namespaces Files Functions Variables Enumerations Properties Pages
Static Public Member Functions | List of all members
SequoiaDB.Bson.BsonUtils Class Reference

A static class containing BSON utility methods. More...

Static Public Member Functions

static string GetFriendlyTypeName (Type type)
 Gets a friendly class name suitable for use in error messages.
 
static byte[] ParseHexString (string s)
 Parses a hex string into its equivalent byte array.
 
static DateTime ToDateTimeFromMillisecondsSinceEpoch (long millisecondsSinceEpoch)
 Converts from number of milliseconds since Unix epoch to DateTime.
 
static string ToHexString (byte[] bytes)
 Converts a byte array to a hex string.
 
static DateTime ToLocalTime (DateTime dateTime)
 Converts a DateTime to local time (with special handling for MinValue and MaxValue).
 
static long ToMillisecondsSinceEpoch (DateTime dateTime)
 Converts a DateTime to number of milliseconds since Unix epoch.
 
static DateTime ToUniversalTime (DateTime dateTime)
 Converts a DateTime to UTC (with special handling for MinValue and MaxValue).
 
static bool TryParseHexString (string s, out byte[] bytes)
 Tries to parse a hex string to a byte array.
 

Detailed Description

A static class containing BSON utility methods.

Member Function Documentation

static string SequoiaDB.Bson.BsonUtils.GetFriendlyTypeName ( Type  type)
inlinestatic

Gets a friendly class name suitable for use in error messages.

Parameters
typeThe type.
Returns
A friendly class name.
static byte [] SequoiaDB.Bson.BsonUtils.ParseHexString ( string  s)
inlinestatic

Parses a hex string into its equivalent byte array.

Parameters
sThe hex string to parse.
Returns
The byte equivalent of the hex string.
static DateTime SequoiaDB.Bson.BsonUtils.ToDateTimeFromMillisecondsSinceEpoch ( long  millisecondsSinceEpoch)
inlinestatic

Converts from number of milliseconds since Unix epoch to DateTime.

Parameters
millisecondsSinceEpochThe number of milliseconds since Unix epoch.
Returns
A DateTime.
static string SequoiaDB.Bson.BsonUtils.ToHexString ( byte[]  bytes)
inlinestatic

Converts a byte array to a hex string.

Parameters
bytesThe byte array.
Returns
A hex string.
static DateTime SequoiaDB.Bson.BsonUtils.ToLocalTime ( DateTime  dateTime)
inlinestatic

Converts a DateTime to local time (with special handling for MinValue and MaxValue).

Parameters
dateTimeA DateTime.
Returns
The DateTime in local time.
static long SequoiaDB.Bson.BsonUtils.ToMillisecondsSinceEpoch ( DateTime  dateTime)
inlinestatic

Converts a DateTime to number of milliseconds since Unix epoch.

Parameters
dateTimeA DateTime.
Returns
Number of seconds since Unix epoch.
static DateTime SequoiaDB.Bson.BsonUtils.ToUniversalTime ( DateTime  dateTime)
inlinestatic

Converts a DateTime to UTC (with special handling for MinValue and MaxValue).

Parameters
dateTimeA DateTime.
Returns
The DateTime in UTC.
static bool SequoiaDB.Bson.BsonUtils.TryParseHexString ( string  s,
out byte[]  bytes 
)
inlinestatic

Tries to parse a hex string to a byte array.

Parameters
sThe hex string.
bytesA byte array.
Returns
True if the hex string was successfully parsed.

The documentation for this class was generated from the following file: