Debugging lambda expressions

Visual Studio 2015 has added the ability for developers to debug lambda expressions. This is a fantastic addition to the features of our favorite IDE. It allows us to check the results of a lambda expression on the fly and modify the expression to test different scenarios.

Getting ready

We will create a very basic lambda expression and change it in the Watch window to produce a different value.

How to do it…

  1. Add a class called CSharpSix. Add a property to this class called FavoriteFeature:
    public class CSharpSix
    {
        public string FavoriteFeature { get; set; }
    }
  2. Next, create a List<CSharpSix> object and add a few of your favorite C# 6 features to this list:
    List<CSharpSix> FavCSharpFeatures = new List<CSharpSix>(); CSharpSix ...

Get C# Programming Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.