| Input: | IEnumerable<TSource> |
| Optional lambda expression: | TSource => bool |
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
class Program
{
static void Main()
{
int[] numbers = { 1, 2, 3, 4, 5 };
int first = numbers.First();
int firstEven = numbers.First(n => n % 2 == 0);
Console.WriteLine(first);
Console.WriteLine(firstEven);
}
}
The output:
1
2java2s.com | | Contact Us | Privacy Policy |
| Copyright 2009 - 12 Demo Source and Support. All rights reserved. |
| All other trademarks are property of their respective owners. |