Click or drag to resize

ConversionOptions Class

Defines the options of a conversion.
Inheritance Hierarchy
SystemObject
  TB.ComponentModelConversionOptions

Namespace:  TB.ComponentModel
Assembly:  UniversalTypeConverter (in UniversalTypeConverter.dll) Version: 2.0.0
Syntax
C#
public class ConversionOptions : IConversionOptions

The ConversionOptions type exposes the following members.

Constructors
  NameDescription
Public methodConversionOptions
Initializes a new instance.
Top
Properties
  NameDescription
Public propertyAllowDefaultValueIfNotConvertible
If true, conversion returns the destination's default value if the given value is not convertible to the given type. This option is false by default.
Public propertyAllowDefaultValueIfNull
If true, conversion returns the destination's default value if the given value is null and the type of destination doesn't support null. This option is false by default.
Public propertyAllowDefaultValueIfWhitespace
If true, conversion returns the destination's default value if the given value is an empty string and otherwise not convertible. This option is false by default.
Public propertyByteArrayFormat
Defines the format used when converting an array of bytes to its equivalent string representation and vice versa. The default format is Base64.
Public propertyConstructorResolvingMode
Defines if and how conversion will try to use a public constructor with it's only parameter beeing of the type of the given source value. The default mode is Strict.
Public propertyDateTimeFormat
Defines the format used when converting a date/time to its equivalent string representation. The default format is "G".
Public propertyDateTimeLongMeaning
Defines the meaning of a Long value when converting to DateTime. The default meaning is Ticks.
Public propertyDateTimePatterns
Gets the list of patterns used when converting a string to its DateTime equivalent. E.g., these patterns are used as formats when calling DateTime.TryParseExact.
Public propertyDateTimeStyle
Defines the DateTimeStyles used when converting a string to its DateTime equivalent. The default is the combination of: DateTimeStyles.AllowLeadingWhite | DateTimeStyles.AllowTrailingWhite.
Public propertyDecimalFormat
Defines the format used when converting a decimal to its equivalent string representation. The default format is "G".
Public propertyDecimalNumberStyle
Defines the NumberStyles used when converting a string to its decimal equivalent. The default is the combination of: NumberStyles.Number | NumberStyles.AllowCurrencySymbol | NumberStyles.AllowExponent.
Public propertyFloatFormat
Defines the format used when converting a float to its equivalent string representation. The default format is "G".
Public propertyFloatNumberStyle
Defines the NumberStyles used when converting a string to its float (float/double) equivalent. The default is the combination of: NumberStyles.Float | NumberStyles.AllowThousands | NumberStyles.AllowTrailingSign | NumberStyles.AllowCurrencySymbol | NumberStyles.AllowExponent.
Public propertyGuidFormat
Defines the format used when converting a guid to its equivalent string representation. The default format is "D".
Public propertyHandleDBNullAsNull
If true, Value is handled the same way as null. This option is true by default.
Public propertyIntegerFormat
Defines the format used when converting an integer to its equivalent string representation. The default format is "G".
Public propertyIntegerNumberStyle
Defines the NumberStyles used when converting a string to its integer (byte/int/long/sbyte/short/uint/ulong/ushort) equivalent. The default is the combination of: NumberStyles.Integer | NumberStyles.AllowThousands | NumberStyles.AllowDecimalPoint | NumberStyles.AllowTrailingSign | NumberStyles.AllowCurrencySymbol | NumberStyles.AllowExponent.
Public propertyPropertyResolvingMode
Defines if and how conversion will try to use a public property which matches the given type and whos name is identically to a constructor parameter. The default mode is Strict.
Top
Extension Methods
  NameDescription
Public Extension MethodAsT
Converts the given value to the given type using the default converter. The result provides access to the converted value if conversion succeeded and simplifies access to default values if conversion failed.
(Defined by ObjectExtension.)
Public Extension MethodCanConvert
For backward compatibility only. Use IsConvertibleTo(Object, Type, CultureInfo) instead.
(Defined by ObjectExtension.)
Public Extension MethodCanConvertToT (Defined by ObjectExtension.)
Public Extension MethodConvert
For backward compatibility only. Use To(Object, Type, CultureInfo) instead.
(Defined by ObjectExtension.)
Public Extension MethodConvertToT (Defined by ObjectExtension.)
Public Extension MethodIsConvertibleTo(Type, CultureInfo)Overloaded.
Determines whether the given value can be converted to the specified type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodIsConvertibleTo(Type, Object, CultureInfo)Overloaded.
Converts the given value to the given type using the default converter. A return value indicates whether the operation succeeded.
(Defined by ObjectExtension.)
Public Extension MethodIsConvertibleToT(CultureInfo)Overloaded.
Determines whether the given value can be converted to the specified type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodIsConvertibleToT(T, CultureInfo)Overloaded.
Converts the given value to the given type using the default converter. A return value indicates whether the operation succeeded.
(Defined by ObjectExtension.)
Public Extension MethodTo(Type, CultureInfo)Overloaded.
Converts the given value to the given type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodToT(CultureInfo)Overloaded.
Converts the given value to the given type using the default converter.
(Defined by ObjectExtension.)
Public Extension MethodToDictionary
Creates a new dictionary whose key value pairs represent all non static public values of the given source. If source is null, an empty dictionary is created. If source has no non static public properties or fields (eg. int), the dictionary contains only one key named "Value" representing the given value itself.
(Defined by ObjectExtension.)
Public Extension MethodTryConvert
For backward compatibility only. Use IsConvertibleTo(Object, Type, CultureInfo) instead.
(Defined by ObjectExtension.)
Public Extension MethodTryConvertToT (Defined by ObjectExtension.)
Top
See Also