Partager via


UriExtensions.TryReadQueryAs Method (Uri, Type, Object%)

Reads HTML form URL encoded data provided in the URI query string as an object of a specified type.

Namespace:  System.Net.Http
Assembly:  System.Net.Http.Formatting (in System.Net.Http.Formatting.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function TryReadQueryAs ( _
    address As Uri, _
    type As Type, _
    <OutAttribute> ByRef value As Object _
) As Boolean
'Usage
Dim address As Uri
Dim type As Type
Dim value As Object
Dim returnValue As Boolean

returnValue = address.TryReadQueryAs(type, _
    value)
public static bool TryReadQueryAs(
    this Uri address,
    Type type,
    out Object value
)
[ExtensionAttribute]
public:
static bool TryReadQueryAs(
    Uri^ address, 
    Type^ type, 
    [OutAttribute] Object^% value
)
static member TryReadQueryAs : 
        address:Uri * 
        type:Type * 
        value:Object byref -> bool 
public static function TryReadQueryAs(
    address : Uri, 
    type : Type, 
    value : Object
) : boolean

Parameters

  • value
    Type: System.Object%
    When this method returns, contains an object that is initialized from the query component of the URI. This parameter is treated as uninitialized.

Return Value

Type: System.Boolean
true if the query component of the URI can be read as the specified type; otherwise, false.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type Uri. When you use instance method syntax to call this method, omit the first parameter. For more information, see https://msdn.microsoft.com/en-us/library/bb384936(v=vs.108) or https://msdn.microsoft.com/en-us/library/bb383977(v=vs.108).

See Also

Reference

UriExtensions Class

TryReadQueryAs Overload

System.Net.Http Namespace