Filtering Out the Groups that we Don’t Want
[Blog Map] [Table of Contents] [Next Topic]
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:
This blog is inactive.
New blog: EricWhite.com/blog
Blog TOCvar 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;
Code
Code 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.