[ProgClub list] What is IoC?
John Elliot
jj5 at progclub.org
Thu Oct 13 03:33:11 AEDT 2011
On 13/10/2011 3:18 AM, John Elliot wrote:
> IMessageClient mc = Factory.Instance.CreateMessageClient();
And I've never really liked seeing that, so in practice I tend to
implement my Factory like this:
public static class Factory {
private static IFactory Instance;
public static void Configure( IFactory instance ) {
Instance = instance;
}
public IMessageClient CreateMessageClient() {
return Instance.CreateMessageClient();
}
}
Which then allows me to simplify my client code a tad, so it looks like
this:
IMessageClient mc = Factory.CreateMessageClient();
More information about the list
mailing list