I have a method with out parameters like:
void Do(int anInput, out List<string> items, out int count)
{
/* some code */
}
Now I want to transform that signature so that the out parameters are replaced by an object that is returned by that method like:
DoResult Do(int anInput)
{
/* some code */
return new DoResult{Items=TODO, Count=TODO};
}
class DoResult {
public List<string> Items;
public int Count;
}
Is there a refactoring for such a transformation in Visual Studio 2010 or ReSharper 7?
I know the ReSharper refactoring Extract Class From Parameters. But it seems it doesn't help me for out parameters.
Update: Daniel A. White's answer is very good for .Net 4.0. Is there a solution for .Net 3.5? Generation of a Tuple is also ok.
outparameters by ReSharper's Extract Method refactoring.