This project is read-only.

ref/out without type in lambdas

Topics: C# Language Design
Jul 14, 2014 at 8:28 AM
Hello!
(I'm sorry if this is is not right place for questions like this.)

I have a little suggestion about C# language.
Let us have delegate like this:
delegate T Parse<T>(string text);
and we want to create an instance:
Parse<int> parse = text => Int32.Parse(text);
All is OK. What about ref/out parameters in a delegate?
delegate bool TryParse<T>(string text, out T result);
when we want to create an instance…
TryParse<int> parse1 = (string text, out int result) => Int32.TryParse(text, out result);
…we shoud to specify types on parameters. Why is this required? What about next syntax:
TryParse<int> parse2 = (text, out result) => Int32.TryParse(text, out result);
?