i have downloaded the book "List-EBook" http://www.c-sharpcorner.com/ebooks/free/61/programming-list-with-C-Sharp.aspx from and running list sample,i have doubt on 4th page sample u have given that,
We can also limit the size of a list. The following code snippet creates a list where the key type is float and the total number of items it can hold is 3.
List PriceList = new List(3);
The following code snippet adds items to the list.
PriceList.Add(3.25f);
PriceList.Add(2.76f);
PriceList.Add(1.15f);
but i am able to add more list item in this sample although its limit (3) is given.
clear my doubt,
Thanks.
but i am able to add more list item in this sample although its limit (3) is given.
clear my doubt,
Thanks.
VulpesPosted Dec 6, 2012, 5:31 AM
It doesn't place a limit on the number of items that can be added to the List because the capacity will be increased automatically when the current capacity is exceeded.
The default initial capacity is 4 and is doubled as needed.
nallyaPosted Dec 6, 2012, 5:42 AM
thanks,sir
i just took example and add another list item and it gets added thats asked.
Thanks.