tagged [anonymous-methods]
anonymous delegates in C#
anonymous delegates in C# I can't be the only one getting tired of defining and naming a delegate for just a single call to something that requires a delegate. For example, I wanted to call .Refresh()...
- Modified
- 10 Jun at 21:25
Assigning property of anonymous type via anonymous method
Assigning property of anonymous type via anonymous method I am new in the functional side of C#, sorry if the question is lame. Given the following WRONG code: ``` var jobSummaries = from job in jobs ...
- Modified
- 3 Mar at 13:41
C# Cannot use ref or out parameter inside an anonymous method body
C# Cannot use ref or out parameter inside an anonymous method body I'm trying to create a function that can create an Action that increments whatever integer is passed in. However my first attempt is ...
- Modified
- 21 Nov at 02:25
Compiler generated incorrect code for anonymous methods [MS BUG FIXED]
Compiler generated incorrect code for anonymous methods [MS BUG FIXED] See the following code: ``` public abstract class Base { public virtual void Foo() where T : class { Console.WriteLine("b...
- Modified
- 21 Feb at 17:49
Convert this delegate to an anonymous method or lambda
Convert this delegate to an anonymous method or lambda I am new to all the anonymous features and need some help. I have gotten the following to work: ``` public void FakeSaveWithMessage(Transaction t...
- Modified
- 24 Feb at 22:30
Anonymous method as parameter to BeginInvoke?
Anonymous method as parameter to BeginInvoke? Why can't you pass an anonymous method as a parameter to the `BeginInvoke` method? I have the following code: ``` private delegate void CfgMnMnuDlg(DIServ...
- Modified
- 28 Nov at 09:17
Why can't c# use inline anonymous lambdas or delegates?
Why can't c# use inline anonymous lambdas or delegates? I hope I worded the title of my question appropriately. In c# I can use lambdas (as delegates), or the older delegate syntax to do this: So why ...
- Modified
- 22 Apr at 02:47
How do you use Func<> and Action<> when designing applications?
How do you use Func and Action when designing applications? All the examples I can find about Func and Action are as in the one below where you see they technically work but I would like to see them u...
- Modified
- 8 Oct at 12:7
Why don't anonymous delegates/lambdas infer types on out/ref parameters?
Why don't anonymous delegates/lambdas infer types on out/ref parameters? Several C# questions on StackOverflow ask how to make anonymous delegates/lambdas with `out` or `ref` parameters. See, for exam...
- Modified
- 23 May at 10:29
EventHandlers and Anonymous Delegates / Lambda Expressions
EventHandlers and Anonymous Delegates / Lambda Expressions I'm hoping to clear some things up with anonymous delegates and lambda expressions being used to create a method for event handlers in C#, fo...
- Modified
- 18 Jun at 03:5
Self-invoking anonymous functions
Self-invoking anonymous functions In JavaScript, it's not uncommon to see self-invoking functions: While I'm certainly not comparing the languages, I figured such a construct would be translatable to ...
- Modified
- 7 Mar at 19:4
Creating two delegate instances to the same anonymous method are not equal
Creating two delegate instances to the same anonymous method are not equal Consider the following example code: You would imagine that the two delegate instances would compare to be equal, just as the...
- Modified
- 14 Sep at 17:34
Why Local Functions generate IL different from Anonymous Methods and Lambda Expressions?
Why Local Functions generate IL different from Anonymous Methods and Lambda Expressions? Why the C# 7 Compiler turns Local Functions into methods within the same class where their parent function is. ...
- Modified
- 26 Jul at 21:45
Is there a reason for C#'s reuse of the variable in a foreach?
Is there a reason for C#'s reuse of the variable in a foreach? When using lambda expressions or anonymous methods in C#, we have to be wary of the pitfall. For example: Due to the modified closure, th...
- Modified
- 23 May at 12:26
Avoid or embrace C# constructs which break edit-and-continue?
Avoid or embrace C# constructs which break edit-and-continue? I develop and maintain a large (500k+ LOC) WinForms app written in C# 2.0. It's multi-user and is currently deployed on about 15 machines....
- Modified
- 5 Oct at 16:16
Delegates and Lambdas and LINQ, Oh My!
Delegates and Lambdas and LINQ, Oh My! As a fairly junior developer, I'm running into a problem that highlights my lack of experience and the holes in my knowledge. Please excuse me if the preamble he...
- Modified
- 13 Jan at 16:11
Discrete Anonymous methods sharing a class?
Discrete Anonymous methods sharing a class? I was playing a bit with Eric Lippert's `Ref` class from [here](https://stackoverflow.com/questions/2980463/how-do-i-assign-by-reference-to-a-class-field-in...
- Modified
- 23 May at 12:7