How to reference a class that implements certain interface?

Posted by vikp on Stack Overflow See other posts from Stack Overflow or by vikp
Published on 2010-06-09T11:02:17Z Indexed on 2010/06/09 11:22 UTC
Read the original article Hit count: 167

Hi,

I have an interface for logging the exceptions, i.e. IExceptionLogger.

This interface has 3 implementations: DBExceptionLogger, XMLExceptionLogger, CSVExceptionLogger.

I have an application that will make a use of DBExceptionLogger.

The application references only IExceptionLogger. How do I create an instance of DBExceptionLogger within the application.

I can't reference the DBExceptionLogger directly since it will break the purpose of having IExceptionLogger interface.

Thanks

© Stack Overflow or respective owner

Related posts about c#

Related posts about best-practices