DZone Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

Snippets has posted 5883 posts at DZone. View Full User Profile

Last Using LINQ In C#.net

03.27.2012
| 2890 views |
  • submit to reddit
        // description of your code here

int[] val1= { 1, 2, 3, 4, 5, 6 };
	int myLast= val1.Last();
	int odd= val1.myLast(x => x% 2 != 0);

	Console.WriteLine(myLast);
	Console.WriteLine(odd);