RouteUrlExpressionBuilder::TryParseRouteExpression Method (String^, RouteValueDictionary^, String^%)
Parses an expression into a collection of route keys and values, and optionally into a route name.
Assembly: System.Web (in System.Web.dll)
public: static bool TryParseRouteExpression( String^ expression, RouteValueDictionary^ routeValues, [OutAttribute] String^% routeName )
Parameters
- expression
-
Type:
System::String^
The expression as specified in markup.
- routeValues
-
Type:
System.Web.Routing::RouteValueDictionary^
The collection of route keys and their associated values.
- routeName
-
Type:
System::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.
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.
Available since 4.0