Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

QueryStringConverter.ConvertStringToValue Method

Converts a query string parameter to the specified type.

Namespace:  System.ServiceModel.Dispatcher
Assembly:  System.ServiceModel.Web (in System.ServiceModel.Web.dll)
public virtual Object ConvertStringToValue(
	string parameter,
	Type parameterType
)

Parameters

parameter
Type: System.String

The string form of the parameter and value.

parameterType
Type: System.Type

The Type to convert the parameter to.

Return Value

Type: System.Object
The converted parameter.
ExceptionCondition
FormatException

The provided string does not have the correct format.

If the parameterType is a value type and the parameter is null, then the default value of the parameterType is returned.

The following code shows how to convert a string to the specified type.

if (converter.CanConvert(typeof(Int32)))
    converter.ConvertStringToValue("123", typeof(Int32));

.NET Framework

Supported in: 4.5.1, 4.5, 4, 3.5

.NET Framework Client Profile

Supported in: 3.5 SP1

Windows Phone 8.1, Windows Phone 8, Windows 8.1, Windows Server 2012 R2, Windows 8, Windows Server 2012, Windows 7, Windows Vista SP2, Windows Server 2008 (Server Core Role not supported), Windows Server 2008 R2 (Server Core Role supported with SP1 or later; Itanium not supported)

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see .NET Framework System Requirements.

Show:
© 2014 Microsoft. All rights reserved.