Refactoring Steps:
Replace constructor example:
public
class FactoryClass
{
public FactoryClass(int param1)
{
//
}
}
public class
ReferencingClass
{
public FactoryClass
_factoryClass;
public ReferencingClass(int param1)
{
_factoryClass =
new
FactoryClass(param1);
}
}
// result below
public class FactoryClass
{
private FactoryClass(int param1)
{
//
}
public static FactoryClass Create(int param1)
{
return new
FactoryClass(param1);
}
}
public class
ReferencingClass
{
public FactoryClass
_factoryClass;
public ReferencingClass(int param1)
{
_factoryClass =
FactoryClass.Create(param1);
}
}