Skip to content

Instantly share code, notes, and snippets.

@ouzdev
Last active December 10, 2021 13:20
Show Gist options
  • Save ouzdev/683e953577cbcbaf754e81bb126d0884 to your computer and use it in GitHub Desktop.
Save ouzdev/683e953577cbcbaf754e81bb126d0884 to your computer and use it in GitHub Desktop.
int[] numbers = new int[] { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
//LINQ sorgu sözdizimi
var query = from number in numbers
where number < 3
select number;
//LINQ metod sözdizimi
var method = numbers.Where(n => n < 3);
Console.WriteLine("------------Sorgu Sözdizimi Sonuçları------------------");
//Sorgu sözdizimi sonuçlarının ekrana basılması.
foreach (var item in query)
{
Console.WriteLine(item.ToString());
}
Console.WriteLine("------------Metod Sözdizimi Sonuçları------------------");
//Metod sözdizimine ait olan sonuçların ekrana basılması.
foreach (var item in method)
{
Console.WriteLine(item.ToString());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment