
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
What is the Capacity property of SortedList class in C#?
The capacity property in SortedList class has the maximum size of the SortedList.
The default capacity of a SortedList is 16.
You can try to run the following the code to implement Capacity property of SortedList class in C# −
Example
using System; using System.Collections; namespace Demo { class Program { static void Main(string[] args) { SortedList s = new SortedList(); s.Add("S1", "Maths"); s.Add("S2", "Science"); s.Add("S3", "English"); s.Add("S4", "Economics"); Console.WriteLine("Capacity = " + s.Capacity); } } }
Output
Capacity = 16
Above we first added elements to the SortedList.
SortedList s = new SortedList(); s.Add("S1", "Maths"); s.Add("S2", "Science"); s.Add("S3", "English"); s.Add("S4", "Economics");
Then we found out the capacity −
s.Capacity
- Related Articles
- What is the Count property of SortedList class in C#?
- What is the Values property of SortedList class in C#?
- What is the IsFixedSize property of SortedList class in C#?
- What is the IsReadOnly property of SortedList class in C#?
- What is the Keys property of SortedList class in C#?
- What is the Item property of SortedList class in C#?
- What is the Capacity property of an ArrayList class in C#?
- What is the SortedList class in C#?
- Capacity of a SortedList in C#
- Setting the capacity to the actual number of elements in a SortedList object in C#?
- What is the Count property of ArrayList class in C#?
- What is the Count property of BitArray class in C#?
- What is the Count property of Hashtable class in C#?
- What is the Count property of Queue class in C#?
- What is the Count property of Stack class in C#?

Advertisements