I have a similar need.  I do something like this:

public class Bar
{
    public static IFoo makeAFoo( /* args */ )
    {
        IFoo foundInterface = null;
        if( /* read args to figure out what to do */ )
        {
            foundInterface = new A( /* args */):
        }
        else
        {
            foundInterface = new B( /* args */ );
         }
         return foundInterface;
    }
}

public class A : IFoo
{ ... }

public class B : IFoo
{ ... }

hth,

Howard

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to