Generation Operators
Most of LINQ members are offered by the System.Enumerable
class. This also exposes two shared methods, Range
and Repeat
, which provide the ability to generate sequences of elements. Range
allows generating a sequence of integer numbers, as shown in the following code:
It returns IEnumerable(Of Integer)
; therefore you can then query the generated sequence using LINQ. Repeat
allows instead generating a sequence where the specified item repeats the given number of times. Repeat
is generic in that you need to specify the item’s type first. For example, the following code generates a sequence of 10 Boolean values and True
is repeated ...
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.