Create List that is empty and has the default initial capacity in CSharp

Description

The following code shows how to create List that is empty and has the default initial capacity.

Example


using System;/*  ww w  . j  a  va2  s  .c om*/
using System.Collections.Generic;

public class Example
{
    public static void Main()
    {
        List<string> myData = new List<string>();
        Console.WriteLine(myData.Capacity);
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    Collections »




ArrayList
BitArray
Collection
Comparer
HashSet
Hashtable
LinkedList
List
ListDictionary
OrderedDictionary
Queue
SortedList
SortedSet
Stack
StringCollection
StringDictionary