Class Helpers
[StandardModule]
public sealed class Helpers
- Inheritance
-
Helpers
- Inherited Members
Properties
CurrentDateFormat
Returns the current date time format as set by the operating system
public static string CurrentDateFormat { get; }
Property Value
CurrentListSeparator
Returns the list separator as set by the operating system (e.g. "," or ";")
public static string CurrentListSeparator { get; }
Property Value
CurrentNumberFormat
Returns the number format as set by the operating system
public static NumberFormatInfo CurrentNumberFormat { get; }
Property Value
DateFormats
Date formats
public static Dictionary<string, string> DateFormats { get; }
Property Value
- Dictionary<string, string>
Dictionary of available DateFormats
Remarks
DefaultEncoding
Default Encoding (as set by the operating system, usually ISO-8859-1)
public static Encoding DefaultEncoding { get; }
Property Value
DefaultNumberFormat
Default NumberFormat
public static NumberFormatInfo DefaultNumberFormat { get; }
Property Value
- NumberFormatInfo
NumberFormatInfo instance with decimal separator "." and no NumberGroupSeparator
Methods
CalendarMonths()
Returns a list of calendar months from January to December
public static List<Month> CalendarMonths()
Returns
GetRelativePath(string, string)
Creates a relative path from one file or folder to another.
public static string GetRelativePath(string fromPath, string toPath)
Parameters
fromPath
stringContains the directory that defines the start of the relative path.
toPath
stringContains the path that defines the endpoint of the relative path.
Returns
- string
The relative path from the start directory to the end path.
Remarks
This function is a replacement for IO.Path.GetRelativePath() which is only available in later .NET versions. Based on C# code from https://stackoverflow.com/a/32113484
Exceptions
- ArgumentNullException
fromPath
ortoPath
isnull
.- UriFormatException
- InvalidOperationException
StringToDouble(string, NumberFormatInfo)
Converts a string to a double
public static double StringToDouble(string str, NumberFormatInfo format = null)
Parameters
str
stringstring to be converted
format
NumberFormatInfooptional NumberFormatInfo object to use for the conversion. If not provided, the DefaultNumberInfo is used.
Returns
- double
Double value, set to NaN if the string was not parseable. NaN and +-Infinity in the input string are recognized and converted to the correspoing Double value.
getColorPalette(string)
Returns a specified color palette
public static Color[] getColorPalette(string name = "Material")
Parameters
name
stringAvailable color palettes are "Material", "Distinct", "Color Wheel" and "Random". Defaults to "Material".
Returns
- Color[]
A color palette