int intLines;
string str;
TextReader txtReader;
txtReader = Console.In;
Console.WriteLine("How many lines need to be displayed?");
intLines = Convert.ToInt16(txtReader.ReadLine());
Console.WriteLine("Enter the character to be placed as triangle?");
str = txtReader.ReadLine();
Console.Clear();
StringBuilder strBuilder = new StringBuilder(str);
int intCursorYposition = 0;
int intCursorXposition = Console.BufferWidth / 2;
for (int i = 0; i < intLines; i++)
{
if (i % 2 != 0)
{
intLines++;
strBuilder.Append(str);
continue;
}
try
{
Console.SetCursorPosition(intCursorXposition, intCursorYposition);
}
catch (Exception)
{
Console.BackgroundColor = System.ConsoleColor.Blue;
Console.WriteLine("You have entered too large line value that console could not display\nProgram closing");
Console.Beep();
throw new Exception("Exit");
}
Console.Write(strBuilder);
strBuilder.Append(str);
Console.WriteLine();
intCursorYposition++;
intCursorXposition--;
Redis cache is out process cache provider for a distributed environment. It is popular in Azure Cloud solution, but it also has a standalone application to operate upon in case of small enterprises application. How to install Redis Cache on a local machine? Redis can be used as a local cache server too on our local machines. At first install, Chocolatey https://chocolatey.org/ , to make installation of Redis easy. Also, the version under Chocolatey supports more commands and compatible with Official Cache package from Microsoft. After Chocolatey installation hit choco install redis-64 . Once the installation is done, we can start the server by running redis-server . Distributed Cache package and registration dotnet core provides IDistributedCache interface which can be overrided with our own implementation. That is one of the beauties of dotnet core, having DI implementation at heart of framework. There is already nuget package available to override IDistributedCache i...
Comments
Post a Comment