Programming Articles

Page 714 of 2547

MathF.Asinh() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 153 Views

The MathF.Asinh() method in C# returns the inverse hyperbolic sine (arc hyperbolic sine) of a specified single-precision floating-point number. This method is part of the System namespace and is commonly used in mathematical calculations involving hyperbolic functions. The inverse hyperbolic sine function is the inverse of the hyperbolic sine function. For any real number x, Asinh(x) returns the value y such that sinh(y) = x. Syntax Following is the syntax for the MathF.Asinh() method − public static float Asinh(float val); Parameters val − A single-precision floating-point number representing the hyperbolic sine ...

Read More

Add element to SortedSet in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 235 Views

The SortedSet class in C# provides a way to store unique elements in sorted order. To add elements to a SortedSet, you use the Add() method, which automatically maintains the sorted order and prevents duplicate entries. Syntax Following is the syntax for adding elements to a SortedSet − SortedSet sortedSet = new SortedSet(); bool added = sortedSet.Add(element); Parameters element − The element to add to the SortedSet. Return Value The Add() method returns a bool value: true − If the element was successfully added (not a duplicate). false ...

Read More

MathF.Atan() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 150 Views

The MathF.Atan() method in C# is used to return the angle whose tangent is given as a float value argument. This method returns the arctangent (inverse tangent) of the specified number, with the result expressed in radians between -π/2 and π/2. Syntax Following is the syntax for the MathF.Atan() method − public static float Atan (float val); Parameters val − A float representing a tangent value. This parameter can be any real number including positive infinity, negative infinity, or NaN (Not a Number). Return Value The method ...

Read More

Add key and value into OrderedDictionary collection in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 245 Views

The OrderedDictionary collection in C# maintains the insertion order of key-value pairs, combining features of both hashtables and arrays. To add key-value pairs, use the Add() method which accepts the key and value as parameters. OrderedDictionary is part of the System.Collections.Specialized namespace and allows access to elements both by key and by index, making it useful when you need to preserve insertion order. Syntax Following is the syntax for adding key-value pairs to an OrderedDictionary − OrderedDictionary dict = new OrderedDictionary(); dict.Add(key, value); Parameters key − The key of the element ...

Read More

How to get Synchronize access to the Stack in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 178 Views

In C#, the Stack class is not thread-safe by default. To achieve synchronized access to a Stack in a multithreaded environment, you can use the SyncRoot property with the lock statement. This ensures that only one thread can access the Stack at a time, preventing data corruption and race conditions. Syntax Following is the syntax for synchronizing access to a Stack − lock(stack.SyncRoot) { // Thread-safe operations on stack foreach(Object item in stack) { // Process items safely } } ...

Read More

How to rotate a matrix of size n*n to 90-degree k times using C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 955 Views

Rotating a matrix by 90 degrees is a common operation in programming. When we need to rotate a matrix k times, we can optimize by noting that 4 rotations return the matrix to its original state. Therefore, we only need to perform k % 4 rotations. The algorithm works by processing concentric squares within the matrix. For an n×n matrix, there are n/2 concentric squares. In each square, elements move in a cycle of 4 positions during a 90-degree clockwise rotation. 90° Clockwise Rotation Pattern Original ...

Read More

Char.IsDigit() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 2K+ Views

The Char.IsDigit() method in C# determines whether a specified Unicode character is categorized as a decimal digit. This method is useful for validating input, parsing strings, and filtering numeric characters from text. Syntax Following is the syntax for the Char.IsDigit() method − public static bool IsDigit(char ch); Parameters ch − The Unicode character to evaluate. Return Value Returns true if the character is a decimal digit; otherwise, false. Using Char.IsDigit() with Different Characters Example 1 - Testing Non-Digit Characters using System; public ...

Read More

Remove the specified element from a HashSet in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 500 Views

A HashSet in C# is a collection that stores unique elements without any specific order. To remove a specified element from a HashSet, you use the Remove() method, which returns true if the element was found and removed, or false if the element was not present. Syntax The Remove() method follows this syntax − public bool Remove(T item) Parameters item − The element to remove from the HashSet. Return Value The method returns true if the element was successfully found and removed; otherwise, false. ...

Read More

How to print a matrix of size n*n in spiral order using C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 1K+ Views

Printing a matrix in spiral order means traversing the matrix elements layer by layer from the outermost to the innermost layer. We start from the top-left corner and move in a clockwise direction: right, down, left, and up, then repeat for the inner layers. Algorithm Steps Step 1 − Print all elements of the top row from left to right Step 2 − Print all elements of the rightmost column from top to bottom Step 3 − Print all elements of the bottom row from right to left Step 4 − Print all elements of the leftmost ...

Read More

Char.IsHighSurrogate(String, Int32) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 237 Views

The Char.IsHighSurrogate(String, Int32) method in C# determines whether the character at the specified position in a string is a high surrogate. High surrogates are Unicode code units in the range U+D800 to U+DBFF, used as the first part of surrogate pairs to represent characters beyond the Basic Multilingual Plane. Syntax Following is the syntax − public static bool IsHighSurrogate(string str, int index); Parameters str − The string to evaluate. index − The position of the character to evaluate in the string. Return Value Returns true ...

Read More
Showing 7131–7140 of 25,466 articles
« Prev 1 712 713 714 715 716 2547 Next »
Advertisements