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 15 of 196
MathF.Floor() Method in C# with Examples
The MathF.Floor() method in C# returns the largest integer that is less than or equal to a specified float value. This method performs a floor operation, effectively rounding down to the nearest integer for positive numbers and rounding away from zero for negative numbers. Syntax Following is the syntax for the MathF.Floor() method − public static float Floor(float val); Parameters val: A single-precision floating-point number for which to find the floor value. Return Value Returns a float value representing the largest integer less than or equal to the input value. If ...
Read MoreHow to change the visibility of the Cursor of Console in C#
The Console.CursorVisible property in C# allows you to control whether the cursor is visible in the console window. This property accepts a boolean value where true makes the cursor visible and false hides it. Syntax Following is the syntax for using the Console.CursorVisible property − Console.CursorVisible = true; // Makes cursor visible Console.CursorVisible = false; // Hides cursor To check the current visibility status − bool isVisible = Console.CursorVisible; Example - Hiding the Cursor Let us see an example that demonstrates hiding the cursor − using ...
Read MoreHow to change the WindowLeft of the Console
The Console.WindowLeft property in C# gets or sets the leftmost position of the console window area relative to the screen buffer. This property controls the horizontal scrolling position of the console window within the buffer. Syntax Following is the syntax for using the Console.WindowLeft property − Console.WindowLeft = value; int leftPosition = Console.WindowLeft; Parameters The WindowLeft property accepts an int value representing the column position (0-based) where the left edge of the console window should be positioned within the screen buffer. Key Rules The value must be greater than ...
Read MoreUInt32.CompareTo() Method in C# with Examples
The UInt32.CompareTo() method in C# is used to compare the current instance to a specified object or UInt32 and returns an indication of their relative values. This method is essential for sorting operations and determining the ordering relationship between unsigned 32-bit integers. Syntax The UInt32.CompareTo() method has two overloads − public int CompareTo(object value); public int CompareTo(uint value); Parameters value (object) − An object to compare, or null. value (uint) − An unsigned integer to compare. Return Value The method returns an int that indicates the relative order of ...
Read MoreUInt32.Equals() Method in C# with Examples
The UInt32.Equals() method in C# returns a value indicating whether this instance is equal to a specified object or UInt32. This method provides two overloads for comparing 32-bit unsigned integers with different parameter types. Syntax Following are the two overloads of the UInt32.Equals() method − public override bool Equals (object obj); public bool Equals (uint value); Parameters obj − An object to compare with this instance (first overload). value − A 32-bit unsigned integer to compare with this instance (second overload). Return Value Both methods ...
Read MoreHow to change the WindowTop of the Console in C#?
The Console.WindowTop property in C# gets or sets the top position of the console window relative to the screen buffer. This property is useful when you need to programmatically control the console window's vertical position within the buffer area. Syntax Following is the syntax to get or set the WindowTop property − // Get the current WindowTop position int topPosition = Console.WindowTop; // Set the WindowTop position Console.WindowTop = value; Parameters The WindowTop property accepts an integer value representing the top row of the console window area within the screen buffer. The ...
Read MoreUri.HexEscape(Char) Method in C#
The Uri.HexEscape() method in C# converts a specified character into its hexadecimal equivalent representation using percent-encoding. This method is particularly useful for URL encoding where certain characters need to be represented in hexadecimal format for safe transmission in URIs. Syntax Following is the syntax − public static string HexEscape(char ch); Parameters ch − The character to convert to hexadecimal representation. Return Value Returns a string containing the hexadecimal representation of the character in the format %XX, where XX is the two-digit hexadecimal value. HexEscape Character Conversion ...
Read MoreC# BitConverter.ToChar() Method
The BitConverter.ToChar() method in C# converts two consecutive bytes from a byte array into a Unicode character. This method reads two bytes starting at a specified position and interprets them as a 16-bit Unicode character using little-endian byte order. Syntax public static char ToChar(byte[] value, int startIndex); Parameters value − The byte array containing the bytes to convert. startIndex − The starting position within the byte array. Two consecutive bytes are read from this position. Return Value Returns a char value formed by combining two bytes ...
Read MoreSingle.Equals() Method in C# with Examples
The Single.Equals() method in C# is used to return a value indicating whether two instances of Single represent the same value. The Single type is an alias for float in C#, so this method compares floating-point values for equality. Syntax The Single.Equals() method has two overloads − public bool Equals(float obj); public override bool Equals(object obj); Parameters obj − The object or float value to compare with the current instance. Return Value Returns true if the specified value is equal to the current instance; otherwise, false. For the object overload, it ...
Read MoreC# BitConverter.ToString(Byte[]) Method
The BitConverter.ToString() method in C# converts an array of bytes to its hexadecimal string representation. Each byte is converted to a two-digit uppercase hexadecimal value, with hyphens separating each pair. Syntax Following is the syntax for the BitConverter.ToString() method − public static string ToString(byte[] value); Parameters value − An array of bytes to convert to hexadecimal string representation. Return Value Returns a string containing hexadecimal pairs separated by hyphens, where each pair represents the corresponding element in the byte array. Byte Array to Hex ...
Read More