JetBrains Rider 2023.2 Help

Code Inspection: Convert to lambda expression (when possible)


Instead of passing an anonymous method to a delegate, or using a statement lambda, you can use a lambda expression. This is true only for methods containing a single statement.

Both lambda expressions and anonymous methods can be used to create anonymous functions but lambda expressions provide a shorter syntax for that. There are some minor differences between using these two notations — use the links in the See Also section below to learn the details.

Last modified: 08 March 2021