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 प्रॉपर्टी
कंसोल के बफ़रविड्थ को बदलने के लिए, कंसोल.बफ़रविड्थ गुण का उपयोग करें।
उदाहरण
आइए अब एक उदाहरण देखें -
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