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--;
Lightweight Directory Access Protocol (LDAP), the name itself explain it. An application protocol used over an IP network to access the distributed directory information service. The first and foremost thing is to add references for consuming LDAP. This has to be done by adding reference from Global Assembly Cache (GAC) into project.json "frameworks": { "net461": { "frameworkAssemblies": { "System.DirectoryServices": "4.0.0.0", "System.DirectoryServices.AccountManagement": "4.0.0.0" } } }, These System.DirectoryServices and System.DirectoryServices.AccountManagement references are used to consume LDAP functionality. It is always better to have an abstraction for irrelevant items in consuming part. For an example, the application does not need to know about PrincipalContext or any other dependent items from those two references to make it extensible. So, we can begin wi...
Comments
Post a Comment