C# Class Netduino.WebServer.Core.Utilities.Converter

Exibir arquivo Open project: martinbuberl/Netduino

Public Methods

Method Description
FromAspNetAjax ( string dateTime ) : System.DateTime

Converts an ASP.NET AJAX JSON string into a DateTime object.

FromIso8601 ( string dateTime ) : System.DateTime

Converts an ISO 8601 (UTC) time/date format string into a DateTime object.

FromUtf32 ( int utf32 ) : string

Converts a specified code point into a Unicode encoded string.

FromUtf32 ( uint utf32 ) : string
ToGuid ( string value ) : System.Guid

Creates a Guid from a string value.

ToHexString ( double value ) : string

Converts a hexadecimal number to a hexadecimal string.

ToHexString ( int value ) : string

Converts a hexadecimal number to a hexadecimal string.

ToIso8601 ( System.DateTime dateTime ) : string

Converts a DateTime object into an ISO 8601 (UTC) string.

ToString ( double value ) : string

Converts a Double to a string using a variant of the Double.ToString() method. The problem with the built-in ToString() method is that it wont automatically size the precision to fit the number. So a number like 33.3 gets truncated to just 33 unless you specify exactly the right amount of precision. This method attempts to determine the right amount of precision.

CAUTION!!! I've seen many times when the built-in ToString() method returns a rounding error when you specify any meaningful precision.

Private Methods

Method Description
ThreeDigits ( int value ) : string

Ensures a three-digit number with leading zeros if necessary.

ToHexStringArray ( byte bytes ) : char[]
TwoCharsToByte ( char charOne, char charTwo ) : byte

Ccombines two characters into a single byte value.

TwoDigits ( int value ) : string

Ensures a two-digit number with leading zero if necessary.

Method Details

FromAspNetAjax() public static method

Converts an ASP.NET AJAX JSON string into a DateTime object.
public static FromAspNetAjax ( string dateTime ) : System.DateTime
dateTime string
return System.DateTime

FromIso8601() public static method

Converts an ISO 8601 (UTC) time/date format string into a DateTime object.
public static FromIso8601 ( string dateTime ) : System.DateTime
dateTime string
return System.DateTime

FromUtf32() public static method

Converts a specified code point into a Unicode encoded string.
public static FromUtf32 ( int utf32 ) : string
utf32 int
return string

FromUtf32() public static method

public static FromUtf32 ( uint utf32 ) : string
utf32 uint
return string

ToGuid() public static method

Creates a Guid from a string value.
public static ToGuid ( string value ) : System.Guid
value string
return System.Guid

ToHexString() public static method

Converts a hexadecimal number to a hexadecimal string.
public static ToHexString ( double value ) : string
value double
return string

ToHexString() public static method

Converts a hexadecimal number to a hexadecimal string.
public static ToHexString ( int value ) : string
value int
return string

ToIso8601() public static method

Converts a DateTime object into an ISO 8601 (UTC) string.
public static ToIso8601 ( System.DateTime dateTime ) : string
dateTime System.DateTime
return string

ToString() public static method

Converts a Double to a string using a variant of the Double.ToString() method. The problem with the built-in ToString() method is that it wont automatically size the precision to fit the number. So a number like 33.3 gets truncated to just 33 unless you specify exactly the right amount of precision. This method attempts to determine the right amount of precision.
CAUTION!!! I've seen many times when the built-in ToString() method returns a rounding error when you specify any meaningful precision.
public static ToString ( double value ) : string
value double
return string