I have 2 methods which have almost the same content:
public string Method1(int someInt)
{
if(someBoolean)
return "test";
if(someOtherBoolean)
{
return "dfjakdsad";
}
else
{
string myStr = getString(someInt)
}
}
public string Method2(myEnum myenum)
{
if(someBoolean)
return "test";
if(someOtherBoolean)
{
return "dfjakdsad";
}
else
{
string myStr = getString(myenum)
}
}
The differences are the method signatures and the single statement in the else
, string myStr = getString
Method1 is called from many places so it has to stay in some way. How would I refactor that?