Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lambda expression with 'out' keyword omitting type #2248

Closed
goyzhang opened this issue Feb 20, 2019 · 4 comments
Closed

lambda expression with 'out' keyword omitting type #2248

goyzhang opened this issue Feb 20, 2019 · 4 comments

Comments

@goyzhang
Copy link
Contributor

goyzhang commented Feb 20, 2019

If we define out parameter in a lambda, we have to explicitly define the type like:

           delegate int D<TResult, TArgument>(TArgument argument,  out TResult result);
            D<int, int> d = (int arg, out int rst) => {...};  //have to claim int
            //D<int, int> d = (arg, out rst) => {...};  //CS2046

Can we get rid of int (the type define) for out and do the similar thing like the case without out?

           delegate int D<TResult, TArgument>(TArgument argument,  TResult result);
            D<int, int> d = (arg, rst) => {...};  // without `out`, you can just omit `int`
@Thaina
Copy link

Thaina commented Feb 20, 2019

We already have out var result

@goyzhang
Copy link
Contributor Author

We already have out var result

Yes, I know, but it 's not the case I talked about. And it doesn't work with lambda

@svick
Copy link
Contributor

svick commented Feb 28, 2019

This looks like a duplicate of #338.

@YairHalberstadt
Copy link
Contributor

YairHalberstadt commented Oct 22, 2020

Closing as championed at #338

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants