PersistentSettingsConverter

public static class PersistentSettingsConverter
Used to convert string to string lists and string dictionaries and back to strings again.

Methods

IsStringDictionary

#Since v6.0
public static bool IsStringDictionary(string s)
Determines if the string value is formatted as a key value pair string list.
s (string)String to check
Returns true if it is a XML key value pair list otherwise return false.

IsStringList

#Since v6.0
public static bool IsStringList(string s)
Determines if the string value is formatted as a string list.
s (string)String to check
Returns true if it is a XML string list otherwise return false.

ToString

#Since v6.10
public static string ToString(double value)
Converts a double value to a string.
value (double)double value
Returns the double value as a settings file formatted string.

ToString

#
public static string ToString(KeyValuePair<string, string>[] value)
Converts a key value string pair array to a properly formatted string dictionary XML string.
value (KeyValuePair<string, string>[])List of string pairs to turn into a dictionary XML string.
Returns a properly formatted XML string that represents the string dictionary.

ToString

#Since v6.0
public static string ToString(string[] values)
Converts a string array to a properly formatted string list XML string.
values (string[])List of strings to turn into a string list XML string.
Returns a properly formatted XML string that represents the list of strings.

TryParseDouble

#Since v6.10
public static bool TryParseDouble(string s, out double value)
Converts the string representation of a number to its double-precision floating-point number equivalent. A return value indicates whether the conversion succeeded or failed. system culture.
s (string)A string containing a number to convert.
value (out double)When this method returns, contains the double-precision floating-point number equivalent of the s parameter, if the conversion succeeded, or zero if the conversion failed. The conversion fails if the s parameter is null or Empty, is not a number in a valid format, or represents a number less than MinValue or greater than MaxValue. This parameter is passed uninitialized; any value originally supplied in result will be overwritten.
Returns true if s was converted successfully; otherwise, false..

TryParseEnum

#Since v6.0
public static bool TryParseEnum(Type type, string enumValueName, out int value)
Converts an enumerated value name to its integer equivalent.
type (Type)The enumerated type
enumValueName (string)Enumerated value name as string
value (out int)Output value, will get set to -1 on error
Returns true if the successfully converted or false if not.

TryParseEnum

#Since v6.0
public static bool TryParseEnum(Type type, string intValueAsString, out string value)
Converts an enumerated value string (integer as string) to a enumerated value name.
type (Type)The enumerated type
intValueAsString (string)enumerated integer value as string
value (out string)Output value, will be null on error
Returns true if the successfully converted or false if not.

TryParseStringDictionary

#
public static bool TryParseStringDictionary(string s, out KeyValuePair<string, string>[] value)
Attempts to convert a string to a key value string pair array.
s (string)String to parse
value (out KeyValuePair<string, string>[])Result will get copied here, if the string is null or empty then this will be an empty array, if there was an error parsing then this will be null otherwise it will be the string parsed as a key value string pair array.
Returns true if the string is not empty and properly formatted as a key value string pair list otherwise returns false.

TryParseStringList

#Since v6.0
public static bool TryParseStringList(string s, out string[] value)
Attempts to convert a string to a string value list.
s (string)String to parse
value (out string[])Result will get copied here, if the string is null or empty then this will be an empty list, if there was an error parsing then this will be null otherwise it will be the string parsed as a list.
Returns true if the string is not empty and properly formatted as a string list otherwise returns false.