I have a method like this:
public void Method(bool value)
{
}
Now I want to call this method with a value parsed from an xml file (*.loadtest) which is a string:
<ContextParameter Name="paratemeter" Value="True" />
So, should I do this from the caller:
if(parameter.Equals("True")
Method(true);
else
Method(false);
or should I refactor the Method to get as parameter a string and do the check in there?
I think you should keep
the conversion from strings to actual method parameters and
the actual “work to be done”
in two separate methods. It keeps your methods short and, thus, your code readable.