Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CSHARP

linq from list c#

// Single
string search = "testSearch";
 List<string> list = new List<string>(); // Need to create a string list 
 string result = list.Single(s => s == search);

// Find all where meets the criteria
IEnumerable<string> results = list.Where(s => s == search);
// Select first one
string result = list.First(s => s == search);
 
PREVIOUS NEXT
Tagged: #linq #list
ADD COMMENT
Topic
Name
7+8 =