Last active
December 5, 2022 06:32
-
-
Save syedharoonmca/87508bfa3206dd4428369b7fccb17ef6 to your computer and use it in GitHub Desktop.
LINQQuerySyntax
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace LINQDemo | |
{ | |
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
//Data Source | |
List<int> integerList = new List<int>() | |
{ | |
1, 2, 3, 4, 5, 6, 7, 8, 9, 10 | |
}; | |
//LINQ Query using Query Syntax | |
var QuerySyntax = from obj in integerList | |
where obj > 5 | |
select obj; | |
//Execution | |
foreach(var item in QuerySyntax) | |
{ | |
Console.Write(item + " "); | |
} | |
Console.ReadKey(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment