
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
How to change the WindowWidth of the Console in C#?
Use the Console.WindowWidth Property to change the WindowWidth of the Console.
Example
Let us now see an example −
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; class Demo { public static void Main (string[] args) { Console.InputEncoding = Encoding.ASCII; Console.WriteLine("Input Encoding Scheme = "+Console.InputEncoding); Console.OutputEncoding = Encoding.ASCII; Console.WriteLine("Output Encoding Scheme = "+Console.OutputEncoding); Console.CursorVisible = false; Console.Write("
Cursor is Visible? "+ Console.CursorVisible); Console.WindowWidth = 30; Console.Write("WindowWidth = "+Console.WindowWidth); } }
Output
This will produce the following output −
Input Encoding Scheme = System.Text.ASCIIEncoding Output Encoding Scheme = System.Text.ASCIIEncoding Cursor is Visible? False WindowWidth = 30
- Related Articles
- How to change the WindowLeft of the Console
- How to change the CursorLeft of the Console in C#?
- How to change the CursorSize of the Console in C#?
- How to change the CursorTop of the Console in C#?
- How to change the WindowHeight of the Console in C#?
- How to change the WindowTop of the Console in C#?
- How to change BufferWidth of the Console in C#?
- How to change BufferHeight of the Console in C#?
- How to change the size of the Console using PowerShell?
- How to change the visibility of the Cursor of Console in C#
- How to change the Foreground Color of Text in C# Console?
- How to change the Background Color of Text in C# Console
- How to change the Title of the console using PowerShell command?
- How to change the Input Encoding Scheme of the C# Console?
- How to change the Output Encoding Scheme of the C# Console?

Advertisements