tagged [lambda]

Group by with multiple columns using lambda

Group by with multiple columns using lambda How can I group by with multiple columns using lambda? I saw examples of how to do it using linq to entities, but I am looking for lambda form.

12 Sep at 10:53

Syntax behind sorted(key=lambda: ...)

Syntax behind sorted(key=lambda: ...) I don't quite understand the syntax behind the `sorted()` argument: Isn't `lambda` arbitrary? Why is `variable` stated twice in what looks like a `dict`?

24 Apr at 21:58

FindAll vs Where extension-method

FindAll vs Where extension-method I just want know if a "FindAll" will be faster than a "Where" extentionMethod and why? Example : or Which is better ?

7 Oct at 14:17

Difference between lambda expression and method group

Difference between lambda expression and method group What's the difference between and ? Resharper suggests to use the first expression.

3 Jul at 12:11

How to return value with anonymous method?

How to return value with anonymous method? This fails with the error > Cannot convert lambda expression to type 'string' because it is not a delegate type What does the error mean and how can I resolv...

5 Jun at 05:20

Objective-C code blocks equivalent in C#

Objective-C code blocks equivalent in C# How would I write the equivalent code in C#:

Why would you use Expression<Func<T>> rather than Func<T>?

Why would you use Expression> rather than Func? I understand lambdas and the `Func` and `Action` delegates. But expressions stump me. In what circumstances would you use an `Expression>` rather than a...

19 Apr at 13:53

Simple Examples of joining 2 and 3 table using lambda expression

Simple Examples of joining 2 and 3 table using lambda expression Can anyone show me two simple examples of joining 2 and 3 tables using `LAMBDA EXPRESSION(` for example using Northwind tables (Orders,...

27 May at 10:9

GroupBy in lambda expressions

GroupBy in lambda expressions How would you write the above as a lambda expression? I'm stuck on the `group into` part.

27 May at 21:42

Can a lambda expression be declared and invoked at the same time in C#?

Can a lambda expression be declared and invoked at the same time in C#? In VB.NET, a lambda expression can be declared and invoked on the same line: Is this possible in C#?

9 Jul at 15:15

.NET / C# - Convert List to a SortedList

.NET / C# - Convert List to a SortedList What is the best way to convert a List to SortedList? Any good way to do it without cycling through it? Any clever way to do it with an OrderBy()? Please read ...

11 Jun at 17:24

FirstOrDefault returns NullReferenceException if no match is found

FirstOrDefault returns NullReferenceException if no match is found Here is my code: The code works fine if `x.Value.ID` matches `options.ID`. However, I get a `NullReferenceException` if it doesn't.

1 Nov at 14:54

How to remove a lambda event handler

How to remove a lambda event handler I recently discovered that I can use lambdas to create simple event handlers. I could for example subscribe to a click event like this: But how would you unsubscri...

20 Nov at 10:35

Lambda expression with a void input

Lambda expression with a void input Ok, very silly question. is a lambda representing the same thing as a delegate for But what is the lambda equivalent of ?? Thanks a lot!

2 Oct at 12:37

Lambda Expression: == vs. .Equals()

Lambda Expression: == vs. .Equals() This is a purely academic question, but what's the difference between using == and .Equals within a lambda expression and which one is preferred?

16 Feb at 15:15

Select every second element from array using lambda

Select every second element from array using lambda C# 4.0. How can the following be done using lambda expressions?

26 Oct at 07:56

loop for inside lambda

loop for inside lambda I need to simplify my code as much as possible: it needs to be one line of code. I need to put a for loop inside a lambda expression, something like that:

11 May at 14:24

How to cast Expression<Func<T, DateTime>> to Expression<Func<T, object>>

How to cast Expression> to Expression> I've been searching but I can't find how to cast from the type to the type: So I must turn again to the SO vast knowledge ;)

8 Apr at 09:50

LINQ Select Distinct Count in Lambda form

LINQ Select Distinct Count in Lambda form Given a linq expression of an object collection 'items' such as this: Is it possible to convert this to use linq functions/lambdas:

7 Jul at 11:32

linq to sql join on multiple columns using lambda

linq to sql join on multiple columns using lambda Can someone help me to translate this into lambda query? Thanks.

25 Apr at 13:50

How do I use lambda expressions to filter DataRows?

How do I use lambda expressions to filter DataRows? How can I search rows in a datatable for a row with Col1="MyValue" I'm thinking something like But of course that doesn't work!

11 Aug at 14:54

Expression Tree Copy or Convert

Expression Tree Copy or Convert How to convert a ExpressionTree of form to where POCO1 and POCO2 are C# objects and both have Int32 Age property

Get N max numbers from a List<int> using lambda expression

Get N max numbers from a List using lambda expression This is my list: How can I get 4 maximum numbers by lambda: I need these ones: `{28, 22, 12, 7}`

31 Jul at 20:30

Lambda expression "IN" operator Exists?

Lambda expression "IN" operator Exists? I'm looking for to build the Lambda expression like the below I don't find any `IN` operator in Lambda expression. Anybody have suggestions?

22 Nov at 07:54

Do I need to kill a thread written like this? Or will it automatically end?

Do I need to kill a thread written like this? Or will it automatically end? Using code like the code below, will the new thread created end on its own after the function returns? I'm pretty new to thr...