Hi,
If your class factory supports the creation of objects that accept
different types of constructor parameter arguments , you may also like
to consider exposing a Create method in your factory that accepts an array
of
generic System.Object objects, which contains the parameters to
initialize your object with.
MyClassFactory.Create(String className, Object[] constructorParams);
When the factory creates the object via reflection, the right
constructor would be invoked based on the type and number of
the parameters passed in constructorParams.
Regards,
Aravind C
<an*******@discussions.microsoft.com> wrote in message
news:0a****************************@phx.gbl...
I have been trying to wrap my head around design patterns
in c# and am very new to this.
I do not understand the point of using factories to create
objects. My understanding is that creating factories to
initialise objects has the benifit of allowing you to
easily add classes without modifying the code.
However in saying this, creating new classes usually
requires requiring new input for the constructors when
requires a change to feed the right data into the factory
to use its constructor anyway. Could anyone here
elaborate on my problem?
Regards
Dan