Language Integrated Query is a way to manipulate list objects and arrays using SQL query.
For manipulating LINQ to array there is an example for that
/*Code to manipulate array with LINQ*/
Ex: string[] Employees = { "Himanshu", "Mahesh", "Robin",
"Neeraj", "Sudheer", "Seema
","Mayuri", "Suresh"
};
var list = from b in Employees
where b.StartsWith("H")
select b;
StringBuilder sb = new StringBuilder();
foreach (string s in list)
{
sb.Append(s + Environment.NewLine);
}
MessageBox.Show(sb.ToString(), "H Employees");
In this example we have a collection of employee array which gets stored into variable using the LINQ query in which we are manipulating it through the LINQ functions.
The function StartsWith("H") will return only those employee whose name starts with R.
0 Comment(s)