Return to Snippet

Revision: 65281
at May 9, 2014 07:04 by heathbo


Updated Code
List<string> testList = new List<string>(){"123","456","789","123","456","789","123","456","789","123","456","789","123","456","789"};

Lambda	
List<string> test = testList.Where(v => v == "123").ToList();

Linq
List<string> test = (from x in testList
    where x == "123"
    select x).ToList();

foreach (var num in test)
{
     Console.WriteLine(num);
}
            
Console.ReadLine();

Results:
"123"
"123"
"123"
"123"
"123"

Revision: 65280
at November 14, 2013 08:36 by heathbo


Initial Code
List<string> testList = new List<string>(){"123","456","789","123","456","789","123","456","789","123","456","789","123","456","789"};
	
List<string> test = testList.Where(v => v == "123").ToList();
Console.WriteLine(test);




Results:
A List<string> with 5 "123".

Initial URL

                                

Initial Description
These are statements to pull all the matching values (123) from the List.

Initial Title
Lambda and Linq Statements to pull all matching values from List

Initial Tags

                                

Initial Language
C#