Skip to content

Feature request: Implicitly typed lambdas #14

@nvivo

Description

@nvivo

Currently, it is not possible to do this:

var x = () => 1;

Instead, you need to declare the type before:

Func<int> x = () => 1;

C# should just assume these kind of lambdas are either Action or Func and infer the type.

Usually these lambdas are used as helpers for the method implementation, so it really wouldn't matter if a (string s) => true is a Func<string, bool> instead of a Predicate<string> as long as the signature matches.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions