.Net Method Overload Documentation



  • Where's the best place for me to find a list of overloads for a method including the parameter names?

    F1 with the method name under the cursor loads a page like this:

    That's fine, but the lack of parameter names makes it difficult to see what's available and which specific overload I need.


  • FoxDev

    It's only the types that matter. You'll never find two overloads with the same number of arguments with the same types in the same order but different parameter names; it's a compiler error.



  • Okay, but compare this:

    BeginForm(HtmlHelper, String, String, Object)
    

    to this:

    BeginForm(this HtmlHelper htmlHelper,
            string actionName,
            string controllerName,
            object routeValues)
    

    In the first one, it's not clear what the two strings are or what the object represents. If I'm looking for an overload that allows me to specify the controller, the first is pretty much useless unless I read the detailed description or click through to the overload specific page.

    Is there somewhere I can see the full list with the parameter names for easier scanning?


  • FoxDev

    Writes an opening <form> tag to the response, and sets the action tag to the specified controller, action, and route values.

    Seems clear enough to me that that overload takes an action, a controller, and some route values.



  • It was just an example, there are far more complex methods.

    If there is no such view in the online docs or in the IDE, that's a valid answer.

    For now, Alt+F12 "peeks" at the definition, which produces something like the following, which is better than nothing.

    For me, when looking at lots of overloads, that is easier to scan than this:

    In the first image, I can very easily see that the initial parameters are always the same and can focus on the parameters to the right to see the variations. In the second, I need to parse a sentence each time.

    I'm not suggesting that the help file isn't perfectly adequate for lots of people, I'm just trying to find out if there's a form better suited to the way I process information. It's not a problem if not, I'll just adapt, but I'm pretty new to .Net so I figured I should check in case I was missing something obvious.



  • I agree, am not a big fan of how this looks on Microsoft's site. I don't think there is an alternative reference out there.

    There's nothing preventing us from fixing what there is, though. I was curious enough to tinker with it for 5 minutes. The result:

    $("#memberList tr:not(:first) > td:nth-child(2)").each(function () {
    	var $el = $(this),
    		url = $el.find("a").attr("href");
    	$.get(url).then(function (html) {
    		$el.append($(html).find(".codeSnippetContainerCode")[0]);
    	});
    });
    

    Drop it in the console and run. Maybe something like this can be made into a greasemonkey script.


  • FoxDev

    @cartman82 said:

    Maybe something like this can be made into a greasemonkey script.

    http://getswole.co.uk/wp-content/uploads/2013/10/3ve7rt-300x298.jpg
    It doesn't bother me all that much, but now I can see what @Keith was getting at.

    Though one thing I'd add is a button to show/hide the signatures on demand.



  • Ooh, nice idea. That's good enough for me.

    I managed to get it working in TamperMonkey.

    I don't have any cheesy poofs, but is this acceptable, @cartman82? 🍰



  • Consider using class view?



  • @Matches said:

    class view

    What this is?



  • If your using visual studio, double click on a dll, it should bring up public classes, and if they are documented with summaries and parameters it will describe what the class items are supposed to do (ymmv)

    If double clicking doesn't work it should be under the tools or view menu. (Not at my computer, so I'm trying to remember. I only use it when I don't have Internet, or if Internet docs aren't good. No reason other than consistent approach)



  • Seconded, I always use the class viewer to find this.



  • @Keith said:

    I don't have any cheesy poofs, but is this acceptable, @cartman82?

    Yeah yeah, that's fine.



  • So who around here is Commander Douchebag?


Log in to reply