Posted By : Murugan Andezuthu Dharmaratnam
Posted On : 13 December 2014
Keywords : Code4Beginner,Beginner,Lamda expression, LINQ with Lamda expression,What is Lamda expression

Lamda Expressions Select

MyList.Select(x => new { x.Id, x.Name }).ToList();


Select applies a method to every element. It is an elegant way to mutate the elements in a collection such as an array. This method receives as a parameter an anonymous.Typically specified as a lambda expression or delegate.
We use Select on this array reference.
String Array
String Literal


Eg:
using System;
using System.Linq;

class Program
{
    static void Main()
    {
	// An input data array.
	string[] array = { "cat", "dog", "mouse" };

	// Apply a transformation lambda expression to each element.
	// ... The Select method changes each element in the result.
	var result = array.Select(element => element.ToUpper());

	// Display the result.
	foreach (string value in result)
	{
	    Console.WriteLine(value);
	}
    }
}

Output
CAT
DOG
MOUSE

Murugan Andezuthu Dharmaratnam

Murugan is a technology leader with 14 years of hands-on experience in full life cycle systems design, development, implementation, and management. In addition to systems design and development, his core competencies include cloud design and architecture, interactive web applications and websites development, mobile computing, and Healthcare Information Technology. His experience is very diverse with a broad range of technologies within multiple industry settings including private, public, and non-profit. Coupled with his technology expertise, Murugan is a well-organized, result-oriented, and a highly analytical leader with proven track record in developing and implementing very complex systems.