Wanzyee Studio
BaseStringConverter< T >abstract

Base class of custom System.ComponentModel.TypeConverter for string and target type. More...

Inherits TypeConverter.

Inherited by NumericStringConverter< T >.

Public Member Functions

override bool CanConvertFrom (ITypeDescriptorContext context, Type sourceType)
 Returns whether this converter can convert an object of one type to the type of this converter. More...
 
override bool CanConvertTo (ITypeDescriptorContext context, Type destinationType)
 Returns whether this converter can convert the object to the specified type. More...
 
override object ConvertFrom (ITypeDescriptorContext context, CultureInfo culture, object value)
 Converts the given value to the type of this converter. More...
 
override object ConvertTo (ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
 Converts the given value object to the specified type. More...
 

Protected Member Functions

virtual string ToString (T value)
 Convert the value of target type to string. More...
 
abstract T FromString (string value)
 Convert the value of string to target type. More...
 

Detailed Description

Base class of custom System.ComponentModel.TypeConverter for string and target type.

Template Parameters
TThe value type.

Member Function Documentation

override bool CanConvertFrom ( ITypeDescriptorContext  context,
Type  sourceType 
)

Returns whether this converter can convert an object of one type to the type of this converter.

Parameters
contextAn ITypeDescriptorContext that provides a format context.
sourceTypeA Type that represents the type you want to convert from.
Returns
true if this converter can perform the conversion; otherwise, false.
override bool CanConvertTo ( ITypeDescriptorContext  context,
Type  destinationType 
)

Returns whether this converter can convert the object to the specified type.

Parameters
contextAn ITypeDescriptorContext that provides a format context.
destinationTypeA Type that represents the type you want to convert to.
Returns
true if this converter can perform the conversion; otherwise, false.
override object ConvertFrom ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value 
)

Converts the given value to the type of this converter.

Parameters
contextAn ITypeDescriptorContext that provides a format context.
cultureThe CultureInfo to use as the current culture.
valueThe object to convert.
Returns
An object that represents the converted value.
override object ConvertTo ( ITypeDescriptorContext  context,
CultureInfo  culture,
object  value,
Type  destinationType 
)

Converts the given value object to the specified type.

Parameters
contextAn ITypeDescriptorContext that provides a format context.
cultureThe CultureInfo to use as the current culture.
valueThe object to convert.
destinationTypeThe Type to convert the value parameter to.
Returns
An object that represents the converted value.
virtual string ToString ( value)
protectedvirtual

Convert the value of target type to string.

Parameters
valueThe target type value.
Returns
The string.
abstract T FromString ( string  value)
protectedpure virtual

Convert the value of string to target type.

Parameters
valueThe string value.
Returns
The instance of target type.

Implemented in NumericStringConverter< T >.