Gets or sets the total number of elements the internal data structure can hold without resizing.
Namespace: System.Collections.GenericAssembly: mscorlib (in mscorlib.dll) Version: 4.0.0.0
Syntaxpublic int Capacity { get; set; }Return Value
Type:
Int32The number of elements that the
ListT can contain before resizing is required.
Exceptions| Exception | Condition |
|---|
| ArgumentOutOfRangeException | Capacity is set to a value that is less than Count. |
| OutOfMemoryException | There is not enough memory available on the system. |
See Also