Server Side Programming Articles

Page 717 of 2109

Check if SortedSet and a specified collection share common elements in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 160 Views

To check if a SortedSet and a specified collection share common elements in C#, you can use the Overlaps() method. This method returns true if the SortedSet shares at least one element with the specified collection, otherwise it returns false. Syntax Following is the syntax for using the Overlaps() method − public bool Overlaps(IEnumerable other) Parameters other − The collection to compare with the current SortedSet. It can be any collection that implements IEnumerable. Return Value The method returns true if the SortedSet shares at least one element with ...

Read More

Get or set the element at the specified index in ArrayList in C#

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

The ArrayList class in C# provides an indexer property that allows you to get or set elements at a specified index using square bracket notation. This property provides direct access to elements by their position in the collection. Syntax Following is the syntax for accessing elements by index in ArrayList − // Get element at index object element = arrayList[index]; // Set element at index arrayList[index] = value; Parameters index − The zero-based index of the element to get or set. value − The object to store at the specified index ...

Read More

Bitwise OR operation between the elements of BitArray in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 143 Views

The Bitwise OR operation between elements of BitArray in C# is performed using the Or() method. This method performs a logical OR operation on corresponding bits of two BitArray objects, returning true when at least one of the corresponding bits is true. Syntax Following is the syntax for performing Bitwise OR operation on BitArray − BitArray result = bitArray1.Or(bitArray2); Parameters bitArray2 − The BitArray with which to perform the bitwise OR operation. Return Value The method returns the current BitArray instance containing the result of the bitwise OR operation. ...

Read More

Get or set the number of elements in the BitArray in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 178 Views

The BitArray.Length property in C# gets or sets the number of elements in the BitArray. This property is essential for determining the size of a BitArray and can also be used to resize it dynamically. Syntax Following is the syntax for getting the length of a BitArray − int length = bitArray.Length; Following is the syntax for setting the length of a BitArray − bitArray.Length = newLength; Getting BitArray Length The Length property returns the total number of elements in the BitArray, regardless of their values − ...

Read More

Getting the list of keys of a SortedList object in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 796 Views

The SortedList class in C# provides the GetKeyList() method to retrieve all keys as an IList collection. This method returns keys in their sorted order, making it useful for accessing or iterating through keys separately from their values. Syntax Following is the syntax for getting the list of keys from a SortedList − IList keyList = sortedList.GetKeyList(); Return Value The GetKeyList() method returns an IList object containing all the keys from the SortedList in sorted order. The returned list is read-only and reflects the current state of the SortedList. Using GetKeyList() Method ...

Read More

Getting the list of Values of a SortedList object in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 154 Views

A SortedList in C# is a collection of key-value pairs sorted by keys. To get the list of values from a SortedList object, you can use the GetValueList() method, which returns an IList containing all the values in the same order as their corresponding keys. Syntax Following is the syntax for getting values from a SortedList − SortedList sortedList = new SortedList(); IList valueList = sortedList.GetValueList(); The GetValueList() method returns an IList object containing all values in key-sorted order. Using GetValueList() with Integer Values This example demonstrates how to extract integer values ...

Read More

Get or set the number of elements that the ArrayList can contain in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 169 Views

The Capacity property of an ArrayList in C# gets or sets the number of elements that the ArrayList can contain without resizing. This is different from the Count property, which represents the actual number of elements currently stored in the ArrayList. When elements are added and the capacity is exceeded, the ArrayList automatically doubles its capacity to accommodate more elements. Syntax Following is the syntax for getting the capacity − int capacity = arrayList.Capacity; Following is the syntax for setting the capacity − arrayList.Capacity = newCapacity; Understanding Capacity vs ...

Read More

Get or Set the value associated with specified key in Hashtable in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 215 Views

In C#, you can get or set the value associated with a specified key in a Hashtable using the indexer hashtable[key]. This provides a convenient way to access and modify values using their keys. Syntax Following is the syntax for getting a value from a Hashtable − object value = hashtable[key]; Following is the syntax for setting a value in a Hashtable − hashtable[key] = value; Getting Values from Hashtable You can retrieve values from a Hashtable using the key as an index. If the key doesn't exist, it ...

Read More

Get an ICollection containing the keys in the Hashtable C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 214 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

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

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 147 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
Showing 7161–7170 of 21,090 articles
« Prev 1 715 716 717 718 719 2109 Next »
Advertisements