Set console properties in another class
I have this weird problem where I have to set the console parameters like
the title, backcolor, forecolor... and don't want to do it over and over.
So I want to make a class that has a method that does it for me in another
project. The why is not so important, I basically want to make common code
to share between projects.
Something like :
// Console type project :
public static class Program
{
public static void Main()
{
SetConsoleParameters(this.Console);
}
}
// Class library
public class SomeLibrary()
{
public Console SetConsoleParameters(Console console)
{
console.Title = "Nice title";
console. // Etc...
}
}
I know you can't pass a static class like the console as a parameter and
you can't access the console by with this but is it somehow possible to
set things up like above ? (In a class that is not in the Console Project.
No comments:
Post a Comment