In the specific example you provided (why it is used like that in the ASP.NET source code) the answer is: yes, it makes a difference whether the (object) cast is there or not.
We have this method:
public static Route MapRoute(this RouteCollection routes, string name, string url)
{
return MapRoute(routes, name, url, null /* defaults */, (object)null /* constraints */);
}
Lets assume we call it like this:
RouteCollection.MapRoute(routes, "SomeName", "SomeUrl");
Because the (object)null cast is in this method, the following method will be called:
public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, object constraints)
{
return MapRoute(routes, name, url, defaults, constraints, null /* namespaces */);
}
Because the last parameter is explicitly object (we casted to that).
Without the cast the following method would be called:
public static Route MapRoute(this RouteCollection routes, string name, string url, object defaults, string[] namespaces)
{
return MapRoute(routes, name, url, defaults, null /* constraints */, namespaces);
}
So basically, the cast is there as an aid to choose the more specific method over the less specific.
You can test it yourself with a simpler example:
public static class TestClass
{
public static void TestMethod(object parameter)
{
}
public static void TestMethod(string[] parameter)
{
}
}
And then call:
TestClass.TestMethod(null); // will call TestMethod(string[] parameter)
TestClass.TestMethod((object)null); // will call TestMethod(object parameter)