Query String Array:
public static void ExecuteBasicStringArray()
{
//create string array
string[] bikes = new string[] { “Yamaha”, “Honda”, “Ducati”, “Suzuki” };
//build LINQ query
//build LINQ query
var queryStrings =
from bike in bikes
where bike == “Honda” || bike == “Yamaha”
select bike;
//view results of query
//view results of query
foreach (var b in queryStrings)
{
Console.WriteLine(b);
}
Console.ReadLine();
}
Query Integer Array:
public static void ExecuteBasicIntArray()
{
//create integer array
//create integer array
int[] numbers = { 46, 99, 69, 35 };
//build LINQ query
//build LINQ query
var queryNums =
from num in numbers
where num < 99
select num;
//view results of query
//view results of query
foreach (var n in queryNums)
{
Console.WriteLine(n);
}
Console.ReadLine();
}