« Where has all the content gone? | Main | Optimizing URL generation in ASP.NET MVC – Part 2 »
Saturday
May022009

Extension method digest #4 RouteBase.AsRoute

This one is very simple but is extremely helpful when dabbling in the System.Web.Routing namespace.  Using AsRoute extension will allow you to get to the properties and methods on the Route type itself like Constraints, Defaults and Url.

public static class RouteBaseExtensions
{
public static Route AsRoute(this RouteBase routeBase)
{
return routeBase as Route;
}
}

Again, a very simple extension method that can help save some time instead of having to cast the object yourself.  If the RouteBase target isn’t a Route itself it will just return null.

PrintView Printer Friendly Version

EmailEmail Article to Friend

Reader Comments (4)

Hello everybody, today really lucky
To introduce you these good online shops now!

Sale: GUCCI Bags, GUCCI Handbags, GUCCI Shoes, GUCCI Clothes, GUCCI Glasses, etc.
http://www.gucciboss.com/

2010 NFL, NFL Jerseys, NFL Jersey, NHL Jerseys, MLB Jerseys, NBA Jerseys, wholesale NFL Jerseys
http://www.2010-nfl.com/


Vibram,Five Fingers,fivefingers,Five Fingers Kso,Five Fingers Classic,Five Fingers Sprint,FiveFingers shoes,Vibram Outlet Sale
http://www.topfivefingers.com/

Christian Louboutin,Christian Louboutin shoes,Christian Louboutin sale,ChristianLouboutin Boots,Christian Louboutin Pumps,Christian Louboutin Sandals
http://www.superchristianlouboutin.com

Vibram
Five Fingers
fivefingers
Five Fingers Kso
Five Fingers Classic
Five Fingers Sprint
FiveFingers shoes


Christian Louboutin
Christian Louboutin shoes
Christian Louboutin sale
Christian Louboutin Boots
Christian Louboutin Pumps
Christian Louboutin Sandals

July 12, 2010 | Unregistered CommenterNHL Jerseys

wholesale gucci clothing provides you the best and cheapest Juicy Purses. All the

products at http://www.gucci-buying.com are 100% high quality, competitive price, free shipping with best and timely service, 100%

satisfaction. Big discount for big order. Welcome to make your choose.

July 30, 2010 | Unregistered Commentergucci clothing

PostPost a New Comment

Enter your information below to add a new comment.

My response is on my own website »
Author Email (optional):
Author URL (optional):
Post:
 
Some HTML allowed: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <code> <em> <i> <strike> <strong>