I have a sln, where a consile application is the starter of thr solution.
How is it possible to log from library project to the console?
(I mean the dll project propapbly don’t allow that,
as it is not always run by the console application. Sometimes by other framework, no?)
It is technically possible for any code to use the
System.Consoleclass to write to the console. However, it is not good form for a library to do this for a number of reasons, including:Instead, you would usually use a logging abstraction such as that provided by
System.Diagnostics.TraceSwitchor by a logging library like log4net. Then you can configure the application to redirect logging statements to the console, another file, a database, or whatever you like really.