C# 12 Pocket Reference by Joseph Albahari & Ben Albahari

C# 12 Pocket Reference by Joseph Albahari & Ben Albahari

Author:Joseph Albahari & Ben Albahari [Joseph Albahari]
Language: eng
Format: epub
Publisher: O'Reilly Media, Inc.
Published: 2023-11-03T00:00:00+00:00


public void Foo (Func<int,bool> predicate) { ... }

In such cases, you need a delegate anyway, and it’s precisely in these cases that lambda expressions are usually terser and cleaner.

Anonymous Methods

Anonymous methods are a C# 2.0 feature that has been mostly subsumed by lambda expressions. An anonymous method is like a lambda expression except that it lacks implicitly typed parameters, expression syntax (an anonymous method must always be a statement block), and the ability to compile to an expression tree. To write an anonymous method, you include the delegate keyword followed (optionally) by a parameter declaration and then a method body. For example:



Download



Copyright Disclaimer:
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.