refactor suggestion? refactor out parameters to return a response class

so for instance:
the following:

public bool GetValue(Guid id, out string currencyCode, out bool exceedsBudget, out decimal value)


could be refactored to:

public GetValueResponse GetValue(Guid id)

where:
class GetValueResponse {

public GetValueRespons( string currencyCode, bool exceedsBudget, decimal value)

{

// set property values

:

}

public string currencyCode { get; private set; }

bool exceedsBudget  { get; private set; }

decimal value  { get; private set; }
}

I know the Extract Class From Parameters refactopr does this for input params, but I use this flexible and extensible pattern quite a lot

1 comment

Hello David,

Thank you very much for this suggestion! I've added a feature request: http://youtrack.jetbrains.net/issue/RSRP-208908
and you've welcome to vote for it.

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

so for instance:
the following:
public bool GetValue(Guid id, out string currencyCode, out bool
exceedsBudget, out decimal value)
could be refactored to:
public GetValueResponse GetValue(Guid id)
where:
class GetValueResponse {
public GetValueRespons( string currencyCode, bool exceedsBudget,
decimal value)
{
// set property values
:
}
public string currencyCode { get; private set; }
bool exceedsBudget  { get; private set; }
decimal value  { get; private set; }
}
I know the Extract Class From Parameters refactopr does this for input
params, but I use this flexible and extensible pattern quite a lot



0

Please sign in to leave a comment.