I work with a web service that offers almost duplicated code in two namespaces. For example, PigFeet and HorseFeet, both namespaces contain the Feet class and other code that works with the Feet class, so it must be part of the same namespace.
Right now, in my code, I am forced to do something like this:
if( _animalType == AnimalType.Pig )
{
//namespace is pigfeet
PigFeet.Feet feet = new Feet();
feet.WashFeet();
}
if( _animalType == AnimalType.Horse )
{
//namespace is horsefeet
HorseFeet.Feet feet = new Feet();
feet.WashFeet();
}
This leaves me with lots of duplicate code. Is there a way to choose a namespace more dynamically?
source
share