none
Debugger for lamda expression RRS feed

  • Question

  • Hi, Could anyone let me know how can I debug lamda expression .. is there any tool which allow me to see the expression and details during run time? 

    Thanks,

    PT

    Saturday, August 23, 2014 10:00 PM

Answers

  • You can step through the code and hover over variables.  I often use a helper function with complex linq code as shown below.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                List<int> numbers = new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
    
                List<int> results = numbers.AsEnumerable()
                    .Where(x => greaterthan(x, 5)).ToList();
            }
            static bool  greaterthan(int a, int b)
            {
                return a > b;
            }
        }
    }


    jdweng

    Sunday, August 24, 2014 10:52 AM

All replies

  • You can step through the code and hover over variables.  I often use a helper function with complex linq code as shown below.

    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    
    namespace ConsoleApplication1
    {
        class Program
        {
            static void Main(string[] args)
            {
                List<int> numbers = new List<int>() { 1, 2, 3, 4, 5, 6, 7 };
    
                List<int> results = numbers.AsEnumerable()
                    .Where(x => greaterthan(x, 5)).ToList();
            }
            static bool  greaterthan(int a, int b)
            {
                return a > b;
            }
        }
    }


    jdweng

    Sunday, August 24, 2014 10:52 AM
  • Did something not work with the normal debugger?
    Monday, August 25, 2014 8:21 PM