C# | Check if Hashtable has a fixed size Last Updated : 01 Feb, 2019 Comments Improve Suggest changes Like Article Like Report Hashtable.IsFixedSize Property is used to get a value which indicates whether the Hashtable has a fixed size or not. Syntax: public virtual bool IsFixedSize { get; } Return Value: This property returns true if the Hashtable has a fixed size otherwise it returns false. The default is false. Below programs illustrate the above-discussed property: Example 1: CSharp // C# code to check if Hashtable // has a fixed size using System; using System.Collections; class GFG { // Driver code public static void Main() { // Creating a Hashtable Hashtable myTable = new Hashtable(); // Adding elements in Hashtable myTable.Add("G", "Geeks"); myTable.Add("C", "C#"); myTable.Add("D", "Data Structures"); myTable.Add("Q", "Quiz"); // Checking if Hashtable has a fixed size // this will return false Console.WriteLine(myTable.IsFixedSize); } } Output: False Example 2: CSharp // C# code to check if Hashtable // has a fixed size using System; using System.Collections; class GFG { // Driver code public static void Main() { // Creating a Hashtable and // giving it a size of 4 Hashtable myTable = new Hashtable(4); // Adding elements in Hashtable myTable.Add("1", "C"); myTable.Add("2", "C#"); myTable.Add("3", "DS"); myTable.Add("4", "Java"); myTable.Add("5","HTML"); myTable.Add("6", "CSS"); // Checking if Hashtable has a fixed size // this will return false Console.WriteLine(myTable.IsFixedSize); } } Output: False Note: A collection with a fixed size does not allow the addition or removal of elements after the collection is created, but it allows the modification of existing elements. A collection with a fixed size is simply a collection with a wrapper that prevents adding and removing elements. Therefore, if changes are made to the underlying collection, including the addition or removal of elements, the fixed-size collection reflects those changes. Retrieving the value of this property is an O(1) operation. Reference: https://docs.microsoft.com/en-us/dotnet/api/system.collections.hashtable.isfixedsize?view=netframework-4.7.2 Comment More infoAdvertise with us Next Article C# | Check if Hashtable has a fixed size K Kirti_Mangal Follow Improve Article Tags : C# CSharp-Collections-Hashtable CSharp-Collections-Namespace Similar Reads C# | Check if HybridDictionary has fixed size HybridDictionary.IsFixedSize property is used to get a value that indicates whether the HybridDictionary has a fixed size or not. Syntax: public bool IsFixedSize { get; } Return Value: This property always returns false. Below are the programs to illustrate the use of HybridDictionary.IsFixedSize pr 2 min read C# | Check if ListDictionary has a fixed size ListDictionary.IsFixedSize property is used to get a value indicating whether the ListDictionary has a fixed size or not. Syntax: public bool IsFixedSize { get; } Return Value : This property always returns false. Example: CSHARP // C# code to check if ListDictionary // has a fixed size using System 1 min read C# | Check if an Array has fixed size or not Array.IsFixedSize Property is used to get a get a value indicating whether the Array has a fixed size. This property implements the IList.IsFixedSize Property . Syntax: public bool IsFixedSize { get; } Property Value: This property is always return true for all arrays. Below programs illustrate the 2 min read C# | Check if the ArrayList has a fixed size ArrayList represents an ordered collection of an object that can be indexed individually. It is basically an alternative to an array. It also allows dynamic memory allocation, adding, searching and sorting items in the list. ArrayList.IsFixedSize property is used to check whether the ArrayList has a 2 min read C# | Check if the Hashtable contains a specific Key The Hashtable class represents a collection of key-and-value pairs that are organized based on the hash code of the key. The key is used to access the items in the collection. Hashtable.ContainsKey(Object) Method is used to check whether the Hashtable contains a specific key or not. Syntax: public v 2 min read Like