Blog Map
[Blog Map] [Table of Contents] [Next Topic] This blog is inactive. New blog: EricWhite.com/blog
We are not interested in the groups that don’t contain code, so let's get rid of them. To do this, we simply tack a call to the Where operator on the end:
var groupedCodeParagraphs = paragraphsWithText.GroupAdjacent(p => p.Style) .Where(g => g.Key == "Code");
Now, when we run this, we see:
Group of paragraphs styled Code===================Code using System;CodeCode class Program {Code public static void Main(string[] args) {Code Console.WriteLine("Hello World");Code }Code }Code Group of paragraphs styled Code===================Code Hello World
We're getting really close to what we want. We only need to find the comment for each group.
[Blog Map] [Table of Contents] [Next Topic]