Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8219017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 7, 20262026-06-07T13:00:28+00:00 2026-06-07T13:00:28+00:00

i am new in linq. so sometime just do not understand how linq is

  • 0

i am new in linq. so sometime just do not understand how linq is working. so there any tool or buil-in mechanism in VS2010 IDE to debug linq execution in detail. suppose i have this linq query

var to_search = new[] { "Geo", "JCB" };

var result = from sr in list
             let w = to_search.FirstOrDefault(ts => sr.Title.ToLower().Contains(ts.ToLower()))
             where w != null
             let a = new {sr=sr, word=w.ToLower()}
             group a by a.word into g
             orderby g.Count() descending
             let sorted = g.OrderByDescending(a=> a.sr.Title.Select((c, i) => a.sr.Title.Substring(i)).Count(sub => sub.ToLower().StartsWith(a.word)))
             from a in sorted 
             select a.sr;

var completeList = result.Concat(list.Except(result));

how to debug this above linq query in detail. please guide me. thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-07T13:00:29+00:00Added an answer on June 7, 2026 at 1:00 pm

    Much can be written in response to this deceptively simple question! In fact, I have written at length in my article LINQ Secrets Revealed: Chaining and Debugging on Simple-Talk.com. Here is a summary of its key points:

    • You can step into some LINQ queries with the debugger, but it depends on the composition of expressions and statements in the query (because you can only step onto statements).
    • A LINQ method chain works because of a fundamental rule: each non-terminal method takes IEnumerable<T> as input and returns IEnumerable<T> as output.
    • You can inject a “no-op” statement to give you a “stepping stone”, if you will, as long as it conforms to that fundamental rule. That is, realizing that you could always put .Select(z => z) in a method chain without consequence, use a variation of that, to wit: z => { return z; }.
    • You can similarly inject a diagnostic method to provide output rather than just provide a potential breakpoint. LINQPad, the outstanding scratchpad for not just LINQ but C# in general, provides this in the guise of its powerful Dump() method. Dump is an object visualizer that provides amazing visualizations of complex data structures.
    • Based on work by Bart De Smet in his informative article LINQ to Objects – Debugging you can bring a simplified flavor of Dump back into Visual Studio–I provide code attached to my article mentioned at the top.
    • Thanks to Robert Ivanc’s work on LINQPad Visualizer you can even bring the LINQPad visualizer into Visual Studio (though you need to fire it off manually for individual expressions; you cannot hook it up to a Dump() method).

    As a brief example, consider this simple method chain:

    string[] Words = new string[]
    {"   KOOKABURRA", "Frogmouth", "kingfisher   ", "loon", "merganser"};
    
    Words
            .Select(word => word.Trim())
            .Select(word => word.ToLower())
            .Where(word => word.StartsWith("k"))
            .OrderBy(word => word);
    

    Once you include the Dump extension method in your Visual Studio project, you can minimally instrument it like this…

    Words
        .Select(word => word.Trim())
        .Dump()
        .Select(word => word.ToLower())
        .Dump()
        .Where(word => word.StartsWith("k"))
        .Dump()
        .OrderBy(word => word)
        .Dump();
    

    … or more elaborately like this…

    Words
        .Dump(w => "ORIGINAL: " + w, ConsoleColor.Yellow)
        .Select(word => word.Trim())
        .Dump(w => "TRIMMED: " + w, ConsoleColor.Yellow)
        .Select(word => word.ToLower())
        .Dump(w => "LOWERCASE: " + w, ConsoleColor.Green)
        .Where(word => word.StartsWith("k"))
        .Dump(w => "FILTERED to 'K': " + w, ConsoleColor.Red)
        .OrderBy(word => word)
        .Dump(w => "SORTED: " + w, ConsoleColor.Blue);
    

    … to get output rendered as either the left side or right side of the figure, respectively:
    Diagnostic output from Dump method in Visual Studio

    As a teaser, I will say that while this is indeed useful, you really must see the enhanced visualization that LINQPad can do with the same output (here is the link again for your convenience).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a proliferation of new LINQ providers. It is really quite astonishing and
I am new to Linq and extension methods and I guess I just can't
Is there any Visual Studio tool that let's you run C# code without having
I love the Linq syntax and its power, but sometimes I just can't understand
New to MVC3 Razor - linq to sql having spent some time trying to
New to LINQ.. I am curious as to the syntax to do the following
Im new to linq so i still struggle .... I have a collection of
I am new to LINQ. playerData is a list<DataAccess.Team> and I want to initialize
I'm new to LINQ and am having a small issue. I created a DBML
I am somewhat new to LINQ and have a quick question regarding deleting. Say,

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.