Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

Check if Input, Output and Error is redirected on the Console or not in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 295 Views

The Console class in C# provides properties to check if standard input, output, or error streams are redirected from their default console locations. This is useful when your application needs to behave differently based on how it's being executed. Console Redirection Properties The Console class offers three boolean properties to check redirection status − Console.IsInputRedirected // Checks if input is redirected Console.IsOutputRedirected // Checks if output is redirected Console.IsErrorRedirected // Checks if error is redirected Checking Input Redirection To check if the input stream is redirected ...

Read More

StringDictionary Class in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 290 Views

The StringDictionary class implements a hash table with the key and the value strongly typed to be strings rather than objects. It is part of the System.Collections.Specialized namespace and provides a case-insensitive string-based collection. Note: The StringDictionary class is considered obsolete. For new development, use Dictionary which provides better performance and more features. Syntax Following is the basic syntax to create and use a StringDictionary − StringDictionary stringDict = new StringDictionary(); stringDict.Add("key", "value"); string value = stringDict["key"]; Properties Following are the key properties of the StringDictionary class − ...

Read More

Remove the entry at specified index from OrderedDictionary in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 149 Views

The OrderedDictionary class in C# provides the RemoveAt() method to remove an entry at a specified index. This method removes the key-value pair located at the given zero-based index position while maintaining the order of remaining elements. Syntax Following is the syntax for the RemoveAt() method − public void RemoveAt(int index) Parameters index − The zero-based index of the entry to remove from the OrderedDictionary. Using RemoveAt() Method The following example demonstrates removing an entry at a specific index from an OrderedDictionary − using System; using System.Collections; ...

Read More

How to rotate an array k time using C#?

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

Array rotation is a common programming problem where elements are shifted by k positions. When we rotate an array to the right by k positions, the last k elements move to the beginning, and the remaining elements shift right. For example, if we have array [1, 2, 3, 4, 5] and rotate it right by 2 positions, we get [4, 5, 1, 2, 3]. Algorithm The most efficient approach uses the reversal algorithm which works in three steps − Reverse the entire array Reverse the first k elements Reverse the remaining elements from position k ...

Read More

Remove the entry with specified key from ListDictionary in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 169 Views

The ListDictionary class in C# provides the Remove() method to delete entries by their key. This method removes the key-value pair associated with the specified key from the dictionary and returns no value. Syntax Following is the syntax for removing an entry from a ListDictionary − listDictionary.Remove(key); Parameters key − The key of the entry to remove from the ListDictionary. Return Value The Remove() does not return a value. It simply removes the specified key-value pair if the key exists. Using Remove() Method Here's how to remove ...

Read More

Check if HybridDictionary is Synchronized in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 185 Views

The HybridDictionary class in C# provides the IsSynchronized property to check if the dictionary is thread-safe for multi-threaded operations. By default, HybridDictionary is not synchronized, meaning it is not thread-safe. A HybridDictionary automatically switches between a ListDictionary (for small collections) and a Hashtable (for larger collections) based on the number of elements, but remains unsynchronized unless explicitly wrapped. Syntax The IsSynchronized property returns a boolean value indicating thread safety − bool isSync = hybridDictionary.IsSynchronized; To create a synchronized wrapper around a HybridDictionary − HybridDictionary syncDict = (HybridDictionary)HybridDictionary.Synchronized(originalDict); Using IsSynchronized ...

Read More

Char.IsSeparator () Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 236 Views

The Char.IsSeparator() method in C# indicates whether the specified Unicode character is categorized as a separator character. This method checks if the character belongs to the separator category in Unicode, which includes space characters, line separators, and paragraph separators. Syntax Following is the syntax − public static bool IsSeparator(char ch); Parameters ch − The Unicode character to evaluate. Return Value Returns true if the character is categorized as a separator; otherwise, false. Types of Separator Characters The Unicode separator category includes three subcategories − Space Separator ...

Read More

Check if the specified string is in the StringCollection in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 139 Views

To check if a specified string exists in a StringCollection, you use the Contains() method. The StringCollection class is part of the System.Collections.Specialized namespace and provides a collection specifically designed for storing strings. Syntax Following is the syntax for checking if a string exists in StringCollection − bool result = stringCollection.Contains(string value); Parameters value − The string to search for in the StringCollection. Return Value The Contains()

Read More

Only return fields which appear a certain number of times using MySQL DISTINCT?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 137 Views

To return fields appearing a certain number of times using MySQL DISTINCT, you combine GROUP BY, HAVING, and COUNT() functions. The DISTINCT keyword ensures unique groupings, while HAVING filters groups based on their count. Syntax Following is the syntax for returning fields that appear a specific number of times − SELECT DISTINCT columnName, COUNT(columnName) FROM tableName WHERE columnName LIKE 'pattern%' GROUP BY columnName HAVING COUNT(*) > threshold ORDER BY columnName; Key Components DISTINCT − Ensures unique groupings of the column values COUNT() − Counts occurrences of each grouped value GROUP BY − ...

Read More

Count the total number of elements in the List in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 725 Views

To count the total number of elements in a List in C#, you use the Count property. This property returns an integer value representing the current number of elements stored in the list. Syntax Following is the syntax for using the Count property − List list = new List(); int count = list.Count; Return Value The Count property returns an int value representing the number of elements currently in the list. It returns 0 for an empty list. Using Count Property with List Operations Example using System; using System.Collections.Generic; ...

Read More
Showing 9761–9770 of 61,297 articles
« Prev 1 975 976 977 978 979 6130 Next »
Advertisements