Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Csharp Articles
Page 14 of 196
Console.MoveBufferArea() Method in C#
The Console.MoveBufferArea() method in C# is used to copy a specified source area of the screen buffer to a specified destination area. This method allows you to move text and formatting from one part of the console window to another without rewriting the content. Syntax Following is the syntax for the Console.MoveBufferArea() method − public static void MoveBufferArea(int sourceLeft, int sourceTop, int sourceWidth, int sourceHeight, int targetLeft, int targetTop); Parameters sourceLeft − The leftmost column of the source area (0-based index). sourceTop − The topmost row of the source area (0-based index). ...
Read MoreConsole.Read() Method in C#
The Console.Read() method in C# reads a single character from the standard input stream and returns its ASCII value as an integer. Unlike Console.ReadLine() which reads entire lines, Console.Read() processes one character at a time. Syntax Following is the syntax for the Console.Read() method − public static int Read(); Return Value The method returns an int representing the ASCII value of the character read, or -1 if no more characters are available. Using Console.Read() to Get Character ASCII Values Example using System; public class Demo { ...
Read MoreConsole.ReadLine() Method in C#
The Console.ReadLine() method in C# is used to read the next line of characters from the standard input stream. It reads input from the user until the Enter key is pressed and returns the input as a string. This method is commonly used in console applications to capture user input for processing. It waits for user input and returns null if the input stream has been redirected and no more lines are available. Syntax Following is the syntax for the Console.ReadLine() method − public static string ReadLine(); Return Value The method returns ...
Read MoreConsole.ResetColor() Method in C#
The Console.ResetColor() method in C# is used to reset the foreground and background console colors to their default values. This method is particularly useful when you have changed the console colors during program execution and want to restore the original appearance. Syntax Following is the syntax for the Console.ResetColor() method − public static void ResetColor(); Parameters This method takes no parameters. Return Value This method returns void (nothing). Using Console.ResetColor() Method The method restores both foreground and background colors to the system defaults. Here's how colors work in console ...
Read MoreConsole.SetBufferSize() Method in C#
The Console.SetBufferSize() method in C# sets the height and width of the console screen buffer area to the specified values. The buffer size determines how much text the console can hold in memory, which affects scrolling and display capabilities. Syntax Following is the syntax for the Console.SetBufferSize() method − public static void SetBufferSize(int width, int height); Parameters width − The width of the buffer area measured in columns. height − The height of the buffer area measured in rows. The buffer size must be greater than ...
Read MoreUri.IsHexDigit() Method in C#
The Uri.IsHexDigit() method in C# determines whether a specified character is a valid hexadecimal digit. This method returns true if the character is a valid hexadecimal digit (0-9, A-F, a-f), and false otherwise. This method is commonly used when working with URL encoding, parsing hexadecimal values, or validating user input that should contain only hexadecimal characters. Syntax Following is the syntax − public static bool IsHexDigit(char ch); Parameters ch − The character to validate as a hexadecimal digit. Return Value Returns true if the character is ...
Read MoreHow to change the CursorTop of the Console in C#?
The Console.CursorTop property in C# gets or sets the row position of the cursor within the console window. This property allows you to control the vertical position where text will be displayed, enabling you to create formatted console output, menus, or position text at specific locations. Syntax Following is the syntax for using Console.CursorTop − // Get current cursor top position int currentTop = Console.CursorTop; // Set cursor top position Console.CursorTop = value; Parameters The Console.CursorTop property accepts an integer value representing the row position (0-based) where the cursor should be positioned. ...
Read MoreMathF.Min() Method in C# with Examples
The MathF.Min() method in C# returns the smaller of two specified float values. This method is part of the MathF class, which provides mathematical functions optimized for single-precision floating-point numbers. Syntax Following is the syntax − public static float Min(float val1, float val2); Parameters val1 − The first float number to compare. val2 − The second float number to compare. Return Value Returns a float value representing the smaller of the two input parameters. If either value is NaN (Not a Number), the method returns ...
Read MoreHow to change the Input Encoding Scheme of the C# Console?
To change the Input Encoding Scheme of the Console in C#, use the Console.InputEncoding property. This property allows you to specify how the console interprets input characters, which is particularly useful when working with different character sets or international text. Syntax Following is the syntax for setting the console input encoding − Console.InputEncoding = Encoding.EncodingType; To retrieve the current input encoding − Encoding currentEncoding = Console.InputEncoding; Common Encoding Types Encoding Type Description Encoding.UTF8 UTF-8 encoding for Unicode characters Encoding.ASCII ASCII ...
Read MoreHow to change the Output Encoding Scheme of the C# Console?
The Console.OutputEncoding property in C# allows you to change the character encoding scheme used for console output. This is particularly useful when working with non-ASCII characters, special symbols, or when you need to ensure compatibility with specific encoding standards. By default, the console uses the system's default encoding, but you can override this behavior using different encoding schemes like ASCII, UTF-8, UTF-16, or Unicode. Syntax Following is the syntax for setting the output encoding − Console.OutputEncoding = Encoding.EncodingType; To get the current output encoding − Encoding currentEncoding = Console.OutputEncoding; ...
Read More