linq in c#
// Data source
string[] names = {"Bill", "Steve", "James", "Mohan" };
// LINQ Query
var myLinqQuery = from name in names
where name.Contains('a')
select name;
// Query execution
foreach(var name in myLinqQuery)
Console.Write(name + " ");
class LINQQueryExpressions
{
static void Main()
{
// Specify the data source.
int[] scores = new int[] { 97, 92, 81, 60 };
// Define the query expression.
IEnumerable<int> scoreQuery =
from score in scores
where score > 80
select score;
// Execute the query.
foreach (int i in scoreQuery)
{
Console.Write(i + " ");
}
}
}
// Output: 97 92 81
Also in C#:
- how do i foreach c#
- Linq - Random Elements
- unity cycle children
- c# static meaning
- c sharp index of substring
- c# serialize
- ecs get specific entities with component
- get random value from list c#
- instantiate offset unity
- how to insert into a list c#
- constructor in inherited class c#
- get type of variable c#
- c# Sleep
- button color uwp c#
- using mediamanager how to play mp3 files
- Oculus Go virtual mapping
- how to get the last element in an array in c#
- ASP select box all states
- c# declare an int list
- c# shorten an definition
- c# console delay
- how to set progress openedge driver name for odbc connection c#
- iframe set html content c#
- how does Pow work C#