Databases Reference
In-Depth Information
Listing 19-1. LinqToObjects.cs
using System;
using System.Text;
using System.Linq;
using System.Collections.Generic;
namespace Chapter19
{
class LinqToObjects
{
static void Main(string[] args)
{
string[] names = {"James Huddleston", "Pearly", "Ami Knox", å
"Rupali Agarwal",
"Beth Christmas", "Fabio Claudio", "Vamika Agarwal", "Vidya å
Vrat Agarwal"};
IEnumerable<string> namesOfPeople = from name in names
where name.Length <= 16
select name;
foreach (var name in namesOfPeople)
Console.WriteLine(name);
}
}
}
2. Run the program by pressing Ctrl+F5, and you should see the results shown in
Figure 19-5.
Figure 19-5. Retrieving names from a string array using LINQ to Objects
Search WWH ::




Custom Search