2.12. Manipulate or Evaluate the Contents of an Array


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


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 ...

Get Visual Basic 2008 Recipes: A Problem-Solution Approach now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.