Convert>Method to Property... does not work properly with 'out' parameter

Summary: ReSharper>Refactor>Convert>Method to Property... does not work properly with 'out' parameter.

Suppose you have the following code:

class Green
{
private void Foo(out int x)
{
x = 0;
}

public void Bar()
{
int x;
Foo(out x);
System.Console.WriteLine(x);
}
}

Select Foo and choose ReSharper>Refactor>Convert>Method to Property...
The following code will be generated:

class Green
{
private int Foo
{
set { value = 0; }
}

public void Bar()
{
int x;
Foo = x; /* Local variable 'x'might be not initialized before accessing */
System.Console.WriteLine(x);
}
}

Expected result:

class Green
{
private int Foo
{
get { return 0; }
}

public void Bar()
{
int x;
x = Foo;
System.Console.WriteLine(x);
}
}

/*
VS 2005 version 8.0.50727.51
ReSharper build 252
*/

Please sign in to leave a comment.