How to improve performance or simplify .NET code with linq -



How to improve performance or simplify .NET code with linq -

apart database operation, how can simplify or improve code linq ?

example to search in string

string search = "search in list"; ienumerable<string> results = mylist.where(s => s == search);

i utilize linq statements in loops. simple illustration instead of:

for (int = 0; < array.length; i++) { if (array[i] > 10) { ... } }

i might this:

foreach(var value in array.where(item => item > 10)) { ... }

i find myself needing first occurrence of value in list:

var first = orders.firstordefault(order => order.items.count > 1);

performance linq .net-4.0

Comments

Popular posts from this blog

How do I check if an insert was successful with MySQLdb in Python? -

delphi - blogger via idHTTP : error 400 bad request -

postgresql - ERROR: operator is not unique: unknown + unknown -