A list is a set of index accessible objects that provide search, sort and manipulate list objects with functionality. C# List class represents a collection of highly-typed objects which the index can access. In this article we learn how to work with C# lists by adding, removing and searching items using the class methods and properties of list class in a collection of objects.
List<T> in C# covers a list of objects that have been strongly typed. It provides features for listing items, adding list items, searching, sorting, and manipulating list items. T is the type of objects in List<T>, such as int, string, or any user-defined object.
List <T> is required when multiple object items such as student mark data or data on different subject names are used (string). In this case, List<T> can be used to keep that data in a list.
The System.Collection lists <T>.
Generic index and name space start with 0.
We can create a list by calling the builder List; it takes an int type argument that is capacities of the list. If the capacity is not set, the list size will be dynamic, and the list size will be increased each time an element is added. The following syntax is used to create the list.
You can read more about the syntax and how to add elements in a list in this blog here:
Comments
Post a Comment