C# Class bsharptree.example.simpledb.objectid.BsonUtils

A static class containing BSON utility methods.
Mostra file Open project: thoward/bsharptree

Public Methods

Method Description
ParseHexString ( string s ) : byte[]

Parses a hex string to a byte array.

ToDateTimeFromMillisecondsSinceEpoch ( long millisecondsSinceEpoch ) : System.DateTime

Converts from number of milliseconds since Unix epoch to DateTime.

ToHexString ( byte bytes ) : string

Converts a byte array to a hex string.

ToLocalTime ( System.DateTime dateTime, DateTimeKind kind ) : System.DateTime

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

ToMillisecondsSinceEpoch ( System.DateTime dateTime ) : long

Converts a DateTime to number of milliseconds since Unix epoch.

ToUniversalTime ( System.DateTime dateTime ) : System.DateTime

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

TryParseHexString ( string s, byte &bytes ) : bool

Tries to parse a hex string to a byte array.

Method Details

ParseHexString() public static method

Parses a hex string to a byte array.
public static ParseHexString ( string s ) : byte[]
s string The hex string.
return byte[]

ToDateTimeFromMillisecondsSinceEpoch() public static method

Converts from number of milliseconds since Unix epoch to DateTime.
public static ToDateTimeFromMillisecondsSinceEpoch ( long millisecondsSinceEpoch ) : System.DateTime
millisecondsSinceEpoch long The number of milliseconds since Unix epoch.
return System.DateTime

ToHexString() public static method

Converts a byte array to a hex string.
public static ToHexString ( byte bytes ) : string
bytes byte The byte array.
return string

ToLocalTime() public static method

Converts a DateTime to local time (with special handling for MinValue and MaxValue).
public static ToLocalTime ( System.DateTime dateTime, DateTimeKind kind ) : System.DateTime
dateTime System.DateTime A DateTime.
kind DateTimeKind A DateTimeKind.
return System.DateTime

ToMillisecondsSinceEpoch() public static method

Converts a DateTime to number of milliseconds since Unix epoch.
public static ToMillisecondsSinceEpoch ( System.DateTime dateTime ) : long
dateTime System.DateTime A DateTime.
return long

ToUniversalTime() public static method

Converts a DateTime to UTC (with special handling for MinValue and MaxValue).
public static ToUniversalTime ( System.DateTime dateTime ) : System.DateTime
dateTime System.DateTime A DateTime.
return System.DateTime

TryParseHexString() public static method

Tries to parse a hex string to a byte array.
public static TryParseHexString ( string s, byte &bytes ) : bool
s string The hex string.
bytes byte A byte array.
return bool