dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.04k stars 4.03k forks source link

Refactoring: Change return type based on return expression #31969

Open alrz opened 5 years ago

alrz commented 5 years ago
object local() {
    return (1, 2);
}

->

(int, int) local() {
    return (1, 2);
}

This is specifically useful on local functions. So you don't need to spell out the type every time.

(kind of a replacement for var on local functions which we don't have)

MaStr11 commented 5 years ago

Related #29677 (Codefix instead of refactoring)