O'Reilly logo

Visual Basic 2008 Recipes: A Problem-Solution Approach by Rakesh Rajan, Matthew MacDonald, Allen Jones, Todd Herman

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

2.12. Manipulate or Evaluate the Contents of an Array

Problem

You need to perform actions on the contents of an array, such as the following:

  • Determining whether an array contains any data

  • Determining whether an array contains any elements that meet a specific condition

  • Determining whether all elements of an array meet a specific condition

  • Reversing the order of the contents

Solution

Use the appropriate methods (such as All, Any, and Reverse) of the System.Linq.Enumerable class to perform the desired action.

How It Works

The .NET Framework 3.5 introduces the NotInheritable class System.Linq.Enumerable, which contains a long list of special Shared methods, some of which are shown in Table 2-6, called extension methods (which are discussed in recipe ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required