C#의 콘솔 클래스는 콘솔 애플리케이션의 표준 입력, 출력 및 오류 스트림을 나타내는 데 사용됩니다.
C#에서 콘솔 클래스 속성의 몇 가지 예를 살펴보겠습니다. −
Console.CursorLeft 속성
C#에서 콘솔의 CursorLeft를 변경하려면 Console.CursorLeft 속성을 사용하세요.
예시
예를 들어 보겠습니다 -
using System;
class Demo {
public static void Main (string[] args) {
Console.BackgroundColor = ConsoleColor.Blue;
Console.WriteLine("Background color changed = "+Console.BackgroundColor);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\nForeground color changed = "+Console.ForegroundColor);
Console.CursorLeft = 30;
Console.Write("CursorLeft position: "+Console.CursorLeft);
}
}
출력
이것은 다음과 같은 출력을 생성합니다 -

Console.CursorSize 속성
C#에서 콘솔의 CursorSize를 변경하려면 C#에서 Console.CursorSize 속성을 사용하십시오.
예시
예를 들어 보겠습니다 -
using System;
class Demo {
public static void Main (string[] args) {
Console.BackgroundColor = ConsoleColor.Blue;
Console.WriteLine("Background color changed = "+Console.BackgroundColor);
Console.ForegroundColor = ConsoleColor.Yellow;
Console.WriteLine("\nForeground color changed = "+Console.ForegroundColor);
Console.CursorSize = 1;
Console.WriteLine("\nCursorSize = "+Console.CursorSize);
}
}
출력
이것은 다음과 같은 출력을 생성합니다 -

Console.BufferWidth 속성
콘솔의 BufferWidth를 변경하려면 Console.BufferWidth 속성을 사용하십시오.
예시
이제 예를 살펴보겠습니다 -
using System;
class Demo {
public static void Main (string[] args) {
Console.BufferHeight = 200;
Console.WriteLine("Buffer Height = "+Console.BufferHeight);
Console.BufferHeight = 250;
Console.WriteLine("Buffer Width = "+Console.BufferWidth);
}
} 출력
이것은 다음과 같은 출력을 생성합니다 -
Buffer Height = 200 Buffer Width = 200