Articles on Trending Technologies

Technical articles with clear explanations and examples

Tutorix - AI Tutor

Checking the Given Indexes are Equal or not in C#

Siva Sai
Siva Sai
Updated on 17-Mar-2026 659 Views

Indexes are a vital part of working with arrays and other data structures in C#. They help us navigate and manipulate data effectively. This article will guide you on how to check whether given indexes in a data structure are equal or not in C#. Understanding Indexes in C# In C#, an index represents a position in an array or collection. The index of the first element is 0, and it increases by one for each subsequent element. This is called zero-based indexing. Array Index Positions ...

Read More

Check if the Hashtable contains a specific Key in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 396 Views

To check if a Hashtable contains a specific key in C#, use the ContainsKey() method. This method returns true if the specified key exists in the Hashtable, and false otherwise. Syntax Following is the syntax for the ContainsKey() method − public virtual bool ContainsKey(object key) Parameters key − The key to locate in the Hashtable. Return Value Returns true if the Hashtable contains an element with the specified key; otherwise, false. Using ContainsKey() with String Keys Example using System; using System.Collections; public class Demo ...

Read More

Check if two SortedSet objects are equal in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 300 Views

In C#, checking if two SortedSet objects are equal involves understanding that SortedSet uses reference equality by default with the Equals() method. This means two sets are considered equal only if they reference the same object in memory, not if they contain the same elements. To properly check if two SortedSet objects contain the same elements, you need to use the SetEquals() method or implement custom comparison logic. Using Equals() Method (Reference Equality) The Equals() method checks if two SortedSet objects reference the same instance in memory − using System; using System.Collections.Generic; public class ...

Read More

Get an ICollection containing the keys in the Hashtable C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 237 Views

To get an ICollection containing the keys in the Hashtable, you can use the Keys property. The Hashtable.Keys property returns an ICollection object that contains all the keys from the hashtable, which can then be iterated through to access each key. Syntax Following is the syntax for accessing keys from a Hashtable − ICollection keys = hashtable.Keys; Return Value The Keys property returns an ICollection containing all the keys in the Hashtable. The order of keys is not guaranteed as Hashtable does not maintain insertion order. Hashtable Keys ...

Read More

Console.TreatControlCAsInput Property in C# with Examples

Siva Sai
Siva Sai
Updated on 17-Mar-2026 285 Views

The Console.TreatControlCAsInput property in C# is a Boolean property that determines whether the Ctrl+C key combination is treated as ordinary input or as an interruption signal handled by the operating system. By default, pressing Ctrl+C terminates a console application. However, setting this property to true allows the application to capture Ctrl+C as regular input, preventing automatic termination. Syntax Following is the syntax for setting and getting the Console.TreatControlCAsInput property − // Setting the property Console.TreatControlCAsInput = true; // or false // Getting the property value bool treatAsInput = Console.TreatControlCAsInput; Default Behavior ...

Read More

Check if the StringDictionary contains a specific key in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 234 Views

The StringDictionary class in C# provides the ContainsKey() method to check if a specific key exists in the dictionary. This method returns true if the key is found, otherwise false. Note that StringDictionary automatically converts keys to lowercase for storage and comparison. Syntax Following is the syntax for using the ContainsKey() method − bool ContainsKey(string key) Parameters key − The string key to search for in the StringDictionary. Return Value Returns true if the StringDictionary contains the specified key; otherwise, false. Using ContainsKey() Method Example ...

Read More

Convert a Character to the String in C#

Siva Sai
Siva Sai
Updated on 17-Mar-2026 943 Views

Character manipulation is a common task in many programming applications. This article will guide you through the process of converting a character to a string in C#, an essential operation in various programming scenarios such as data parsing, formatting, and string building operations. Understanding Characters and Strings in C# Before we dive into the conversion process, let's first understand what characters and strings are in C#. A character (char) represents a single Unicode character and is denoted inside single quotes, while a string is a sequence of characters enclosed in double quotes. Character ...

Read More

Check if the StringDictionary contains a specific value in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 218 Views

The StringDictionary class in C# provides the ContainsValue() method to check if a specific value exists in the dictionary. This method returns true if the value is found, otherwise false. Note that StringDictionary automatically converts all keys to lowercase, but values remain case-sensitive. Syntax Following is the syntax for checking if a StringDictionary contains a specific value − public virtual bool ContainsValue(string value) Parameters value − The string value to locate in the StringDictionary. The value can be null. Return Value Returns true if the StringDictionary contains an element ...

Read More

Gets an ICollection containing the values in the Hashtable in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 172 Views

The Hashtable.Values property in C# returns an ICollection containing all the values in the Hashtable. This allows you to iterate through or manipulate the values without accessing the keys directly. Syntax Following is the syntax to get the values collection from a Hashtable − public virtual ICollection Values { get; } Return Value The Values property returns an ICollection containing all the values in the Hashtable. The order of values is not guaranteed since Hashtable does not maintain insertion order. Using Hashtable.Values Property Example using System; using System.Collections; ...

Read More

Get a collection of keys in the StringDictionary in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 220 Views

The StringDictionary class in C# provides the Keys property to retrieve a collection of all keys in the dictionary. This property returns an ICollection containing all the keys, which can be copied to an array or iterated through directly. Syntax Following is the syntax for accessing the Keys property − StringDictionary dictionary = new StringDictionary(); ICollection keys = dictionary.Keys; To copy keys to an array − string[] keyArray = new string[dictionary.Count]; dictionary.Keys.CopyTo(keyArray, 0); Using Keys Property The following example demonstrates how to retrieve and display all keys from a ...

Read More
Showing 10221–10230 of 61,298 articles
Advertisements