Is it possible to output values to the console from within a class library?
For example
Console App -> calls method in -> assembly > function
Is it possible to write a console.out method in the function of the assembly?
I know in web its possible to get the httpcontext, and do a response.write.
Yup, Console.WriteLine
etc will work just fine in a class library... but there's no guarantee that anything is listening to the console. If you use it from a WinForms app or a web app, that output may well go absolutely nowhere...
Have you thought of using a logging library such as log4net instead?
It depends on what type of application is going to use your class library. If it is used in a console application, then the output will be printed to the console. If it is a WinForms, Windows Service or ASP.NET application the output will be ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With