See code in my repository, copy WindowUtility.cs. I use it by placing in a class project named ConsoleHelperLibrary in a folder named Classes.
See this example
Then once adding a reference to ConsoleHelperLibrary use it as follows
namespace YourNamespaceGoesHere
{
partial class Program
{
[ModuleInitializer]
public static void Init()
{
W.SetConsoleWindowPosition(W.AnchorWindow.Fill);
}
}
}
Tip as in the above I have Program setup as a partial class and the above code would be in the following
For anyone reading this using .NET Core 5 you can use my NuGet package.