C# Class ImageProcessor.Web.Helpers.QueryParamConverter

Converts the value of an object into a different data type. The code here is adapted from the TypeConverter class
Inheritance: IQueryParamConverter
显示文件 Open project: JimBobSquarePants/ImageProcessor

Public Methods

Method Description
CanConvertFrom ( Type sourceType ) : bool

Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.

CanConvertTo ( Type destinationType ) : bool

Gets a value indicating whether this converter can convert an object to the given destination type.

ConvertFrom ( CultureInfo culture, object value, Type propertyType ) : object

Converts the given object to the type of this converter, using the specified culture information.

ConvertFromInvariantString ( string text, Type propertyType ) : object

Converts the given string to the converter's native type using the invariant culture.

ConvertTo ( CultureInfo culture, object value, Type destinationType ) : object

Converts the given value object to the specified type, using the specified culture information.

Protected Methods

Method Description
GetConvertFromException ( object value ) : Exception

Gets a suitable exception to throw when a conversion cannot be performed.

GetConvertToException ( object value, Type destinationType ) : Exception

Gets a suitable exception to throw when a conversion cannot be performed.

Method Details

CanConvertFrom() public method

Returns whether this converter can convert an object of the given type to the type of this converter, using the specified context.
public CanConvertFrom ( Type sourceType ) : bool
sourceType System.Type /// A that represents the type you want to convert from. ///
return bool

CanConvertTo() public method

Gets a value indicating whether this converter can convert an object to the given destination type.
public CanConvertTo ( Type destinationType ) : bool
destinationType System.Type The destination type.
return bool

ConvertFrom() public method

Converts the given object to the type of this converter, using the specified culture information.
The conversion cannot be performed.
public ConvertFrom ( CultureInfo culture, object value, Type propertyType ) : object
culture System.Globalization.CultureInfo /// The to use as the current culture. ///
value object The to convert.
propertyType System.Type The property type that the converter will convert to.
return object

ConvertFromInvariantString() public method

Converts the given string to the converter's native type using the invariant culture.
public ConvertFromInvariantString ( string text, Type propertyType ) : object
text string The value to convert from.
propertyType System.Type The type to convert from.
return object

ConvertTo() public method

Converts the given value object to the specified type, using the specified culture information.
/// The parameter is null. /// The conversion cannot be performed. ///
public ConvertTo ( CultureInfo culture, object value, Type destinationType ) : object
culture System.Globalization.CultureInfo /// A . If null is passed, the current culture is assumed. ///
value object The to convert.
destinationType System.Type /// The to convert the parameter to. ///
return object

GetConvertFromException() protected method

Gets a suitable exception to throw when a conversion cannot be performed.
protected GetConvertFromException ( object value ) : Exception
value object The value to convert
return System.Exception

GetConvertToException() protected method

Gets a suitable exception to throw when a conversion cannot be performed.
protected GetConvertToException ( object value, Type destinationType ) : Exception
value object The value to convert
destinationType System.Type The destination type to convert to.
return System.Exception