Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace LinqToArray
- {
- class Program
- {
- static void Main(string[] args)
- {
- //data source
- int[] numbers = new int[10] {1,2,3,4,5,6,7,8,9,10};
- //query creation
- var queryNumber = from num in numbers
- where (num % 2) == 0
- select num;
- //query execution
- foreach (int num in queryNumber)
- {
- Console.WriteLine(num);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment