I need to understand, how to access the console generated by the application console, from one class in another project, and write it dynamically. tried several solutions and none worked.
Down here are the scripts I'm trying to figure out how to do.
This Program is inside a console application project
public static void Main ( string[] args )
{
Console.WriteLine("hello");
LogToConsole ( "Go" );
Console.ReadLine ( );
}
public static void LogToConsole ( string message )
{
Console.WriteLine( message );
}
This Log is inside an WEB API project
this project have a ref of console application
public static class Log
{
public static void Access ( string information )
{
Program.LogToConsole ( information );
}
}
This project, when the WEB API is accessed, it pass a message that will be passed to this Access method.
How can I write a line in this console that is open from this other project?