ערוך

שתף באמצעות


RouteUrlExpressionBuilder.TryParseRouteExpression Method

Definition

Parses an expression into a collection of route keys and values, and optionally into a route name.

public:
 static bool TryParseRouteExpression(System::String ^ expression, System::Web::Routing::RouteValueDictionary ^ routeValues, [Runtime::InteropServices::Out] System::String ^ % routeName);
public static bool TryParseRouteExpression (string expression, System.Web.Routing.RouteValueDictionary routeValues, out string routeName);
static member TryParseRouteExpression : string * System.Web.Routing.RouteValueDictionary * string -> bool
Public Shared Function TryParseRouteExpression (expression As String, routeValues As RouteValueDictionary, ByRef routeName As String) As Boolean

Parameters

expression
String

The expression as specified in markup.

routeValues
RouteValueDictionary

The collection of route keys and their associated values.

routeName
String

When this method returns, contains a string that represents the name of the route, if expression contains a route key named RouteName. This parameter is passed uninitialized.

Returns

true if parsing was successful; otherwise, false.

Remarks

The TryParseRouteExpression method strips leading and trailing spaces from the expression, and then splits it into key/value pairs by using commas as delimiters. If the route key named RouteName is found, that value is passed back in the routeName parameter and not in routeValues. Otherwise, null is returned for routeName. Leading and trailing spaces are also stripped from individual keys and values.

The TryParseRouteExpression method returns false if the expression is not composed of at least one key/value pair that is in the format key=value, and that uses commas to separate multiple pairs.

Applies to

See also