C# Client Library
A C# Client Library for the AnalyzeRe REST API
Loading...
Searching...
No Matches
AnalyzeRe.Utilities.TypeExtensionMethods Class Reference

Utilities used to format types and properties in a manner suitable to output in error messages, to excel, etc. More...

Static Public Member Functions

static bool AlmostEquals (this DateTime dt1, DateTime dt2, TimeSpan? tolerance=null)
 Determines whether two dates are equal within the supported precision.
 
static bool AlmostEquals (this double d1, double d2, double tolerance=1E-14)
 Determines whether two doubles are equivalent within the specified tolerance.
 
static bool IsIntegerType (this Type t)
 Determines whether a property is an integer type.
 
static bool IsNumeric (this Type t)
 Determines whether a property is numeric.
 
static string NiceTypeName (this Type t)
 Produces a human readable string representation of the provided type name, with special consideration for generics. (Source: https://stackoverflow.com/a/2448918/529618 )
 

Detailed Description

Utilities used to format types and properties in a manner suitable to output in error messages, to excel, etc.

Definition at line 8 of file TypeExtensionMethods.cs.

Member Function Documentation

◆ AlmostEquals() [1/2]

static bool AnalyzeRe.Utilities.TypeExtensionMethods.AlmostEquals ( this DateTime  dt1,
DateTime  dt2,
TimeSpan?  tolerance = null 
)
inlinestatic

Determines whether two dates are equal within the supported precision.

Analyze Re only supports a precision of up to 3 millisecond decimal places, so this is the default tolerance.

Parameters
dt1The first DateTime.
dt2The second DateTime.
toleranceThe allowed difference before the dates are considered not equal. (Default 0.001 milliseconds)
Returns
True if the dates are equivalent within the tolerated duration.

Definition at line 82 of file TypeExtensionMethods.cs.

◆ AlmostEquals() [2/2]

static bool AnalyzeRe.Utilities.TypeExtensionMethods.AlmostEquals ( this double  d1,
double  d2,
double  tolerance = 1E-14 
)
inlinestatic

Determines whether two doubles are equivalent within the specified tolerance.

Parameters
d1The expected value of 'actual'
d2The value to compare to 'expected'
tolerance(Default 1E-14) The relative (ratio) tolerance for the equivalency test. Essentially the number of significant digits that should be equal between the two doubles.

Definition at line 67 of file TypeExtensionMethods.cs.

◆ IsIntegerType()

static bool AnalyzeRe.Utilities.TypeExtensionMethods.IsIntegerType ( this Type  t)
inlinestatic

Determines whether a property is an integer type.

Parameters
tThe type to check.
Returns
True if this property is an integer type.

Definition at line 40 of file TypeExtensionMethods.cs.

◆ IsNumeric()

static bool AnalyzeRe.Utilities.TypeExtensionMethods.IsNumeric ( this Type  t)
inlinestatic

Determines whether a property is numeric.

Parameters
tThe type to check.
Returns
True if this property is numeric.

Definition at line 56 of file TypeExtensionMethods.cs.

◆ NiceTypeName()

static string AnalyzeRe.Utilities.TypeExtensionMethods.NiceTypeName ( this Type  t)
inlinestatic

Produces a human readable string representation of the provided type name, with special consideration for generics. (Source: https://stackoverflow.com/a/2448918/529618 )

Definition at line 12 of file TypeExtensionMethods.cs.


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