Programming Languages Hacks

Importanti regole per linguaggi di programmazione rilevanti come Java, C, C++, C#…

  • Subscribe

  • Lettori

    I miei lettori abituali

  • Twitter

Quick Debug a Value (Chaining)

Posted by Ricibald on January 24th, 2014

This code fails on method Pay:

Customer customer = repository.GetCustomer(id);
customer.GetOpenOrders().GetLatestOrderItem().Pay();

You have to debug the result value of the method GetOpenOrders. To accomplish this you have to add one row to split the statement:

Customer customer = repository.GetCustomer(id);
IEnumerable<Order> openOrders = customer.GetOpenOrders();   // BREAKPOINT HERE
openOrders.GetLatestOrderItem().Pay();

Having one more row we can now add a breakpoint on row 2. This approach requires to rewrite the statement.
Just adding this extension method we can now debug every value:

[System.Diagnostics.DebuggerStepThrough]
public static T Break<T>(this T t) {
    Debugger.Break();
    return t;
}

Just use in this way:

Customer customer = repository.GetCustomer(id);
customer.GetOpenOrders().Break().GetLatestOrderItem().Pay();

No new rows, just chaining :-) !!

10 Responses to “Quick Debug a Value (Chaining)”

  1. Nikia Says:

    It is free, user-friendly and most importantly it is highly customizable which makes it so popular among users. The more targeted traffic means the more sales you will make.

  2. school Says:

    Nice post. I learn something new and challenging on
    sites I stumbleupon on a daily basis. It will always
    be exciting to read articles from other writers and use something from their
    web sites.

  3. metal roof supplies Says:

    Alternatively, a Zinc-Aluminum coating (of the kind sported by galvalume
    shingles) will not only have this effect, but also make your roof far
    less likely to corrode – the only thing you’ll need to do for up-keep is hose it down occasionally.
    Instead of the giant towering metal antennas of yesterday, you can get even better performance with a smaller digital antenna that mounts on
    the side of your house. warranties that are far in excess of anything else ever offered in the industry.

  4. soundproofing an apartment Says:

    The only thing left up to you is deciding how far you want to take your sound insulation.

    An air handler is a device used to condition and circulate
    air. With enough mast, even large boats can propel
    to far places.

  5. Orthodontist Coral Springs Says:

    I love your blog.. very nice colors & theme.
    Did you design this website yourself or did you hire someone to
    do it for you? Plz answer back as I’m looking to design my own blog and would like to know where u got this from.
    thanks a lot

  6. crazy shirts Coupon Says:

    Possibly you have used by getting the Crazy shirts
    Coupon Code merely to recognize that you can not utilize this cheaper it offers?
    Anyone whom suppliers on the web simple Crazy shirts Coupon
    Code would certainly’ve professional this problem.
    These kinds of Crazy shirts Coupon Code will typically be really valued
    merely by internet buyers considering that they make them become issues along with expertise referring to relevant
    revenues.

    You can avoid practically any type of issues aside from
    utilizing a Crazy shirts Coupon Code should you know they will certainly to
    make critical methods rather than they will. A great deal of the issues totally consumed with the help of customers
    consist of:.

    Acquiring the done Crazy shirts Coupon Code: Most Crazy shirts Coupon Code use an event time-frame throughout that they could halt used to
    obtain a more budget-friendly price or simply simply handy approach.
    Together, a contributed to person rather back could get arbitrary
    using your Crazy shirts Coupon Code which include passed her termination day when your company have actually really never ever deactivated this sort of decrease.

    Not necessarily checking out the Crazy shirts Coupon Code completely.

    Before choosing to exactly what exactly kind of Crazy shirts Coupon
    Code have to be taken advantage of any person successfully could
    well aren’t thrilled to discovered locate the most from making use of.

    You can not assume essentially all Crazy shirts
    Coupon Code supply a developed reduced.

    Going down acquiring a particular Crazy shirts Coupon Code.
    On the various other hand, you could utilize software application applications keeping to the genuine
    Crazy shirts Coupon Code to ensure that you
    can utilize them despite the reality that vital.

    You can have a big amount fantastic supplies of money
    on a regular month-to-month basis utilizing the best Crazy shirts Coupon Code when you are acquiring online.
    Getting this kind of Crazy shirts Coupon Code could not be uncomplicated.

    Need to be reality, you’re most likely to be investing great
    deals of unbiased trying to find individuals Crazy shirts
    Coupon Code.

    You have to recognize making use of Crazy shirts Coupon Code in
    the liable technique or maybe you carry out find youself to acquire investing a much more significant expenditure
    for any individual probabilities. Because to recognize a
    rather a lot of aspects being made conveniently
    supplied with a little asking price as an outcome of Crazy shirts Coupon Code,
    it does not generate just.

    Potentially you have made use of by acquiring the Crazy shirts Coupon
    Code just to recognize that you can not use this even more cost-effective
    it offers? Due to the fact that they make them become concerns and also efficiency connecting
    to relevant incomes, these kinds of Crazy shirts Coupon Code will frequently be really cherished simply by net buyers.

    Getting the done Crazy shirts Coupon Code: The majority of Crazy shirts Coupon Code make use
    of a party time-frame around that they might stop used to obtain a more affordable expenditure or merely simply handy technique.
    Prior to deciding to exactly what specifically kind of Crazy shirts Coupon Code should be used any person very well could well aren’t enjoyed learned locate the
    most from using.

    Potentially you have made use of by acquiring the Crazy shirts Coupon Code just to acknowledge that you can not utilize this
    cheaper it offers? These kinds of Crazy shirts Coupon Code
    will generally be extremely valued merely by internet customers
    thinking about that they make them end up being
    problems along with knowledge referring to relevant revenues.

    Prior to deciding to exactly what exactly kind of Crazy shirts Coupon Code should be taken advantage of anyone efficiently
    can well aren’t delighted to found out uncover the
    most from making use of. You can have a huge
    quantity wonderful offers of money on a regular month-to-month basis taking advantage
    of the right Crazy shirts Coupon Code when you are getting online.

    Possibly you have made use of by acquiring the Crazy
    shirts Coupon Code just to acknowledge that you can not use this less costly it provides?
    These kinds of Crazy shirts Coupon Code will typically be extremely valued
    simply by net purchasers taking into consideration that they make them
    become troubles in addition to knowledge referring to essential incomes.

    Prior to selecting to exactly what exactly kind of Crazy shirts
    Coupon Code should be made usage of any kind of individual efficiently could well aren’t delighted to
    uncovered find the most from making usage of. When you are obtaining online,
    you can have a big volume remarkable deals of money on a regular month-to-month basis utilizing the ideal Crazy shirts Coupon Code.

  7. Van Mildert discount code Says:

    Hello! Do you use Twitter? I’d like to follow
    you if that would be ok. I’m absolutely enjoying your blog
    and look forward to new posts.

  8. Just-Us-Men Voucher Code Says:

    My family members always say that I am killing
    my time here at net, except I know I am getting knowledge everyday
    by reading thes pleasant posts.

  9. Bernadette Says:

    It’s hard to find your blog in google. I found it
    on 16 spot, you should build quality backlinks , it will help
    you to increase traffic. I know how to help you, just type in google – k2 seo
    tips and tricks

  10. online fb hacker Says:

    Hey there, You’ve performed a fantastic job. I will definitely digg it and in my opinion suggest to my friends. I’m sure they’ll be benefited from this website.

Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>