Welcome to MSDN Blogs Sign in | Join | Help
Filtering Out the Groups that we Don’t Want

[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:

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;

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.

[Table of Contents]  [Next Topic]

 

Posted: Wednesday, October 04, 2006 5:28 AM by EricWhite

Comments

No Comments

Leave a Comment

(required) 

(required) 

(optional)

(required) 

  
Enter Code Here: Required

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS

Page view tracker