Posts

Showing posts with the label #C# #List<T>

C# - List

The   List<T>   is a collection of strongly typed objects that can be accessed by index and having methods for sorting, searching, and modifying list. It is the   generic   version of the   ArrayList   that comes under   System.Collections.Generic   namespace. List<T> Characteristics List<T>  equivalent of the  ArrayList , which implements  IList<T> . It comes under  System.Collections.Generic  namespace. List<T>  can contain elements of the specified type. It provides compile-time type checking and doesn't perform boxing-unboxing because it is generic. Elements can be added using the  Add() ,  AddRange()  methods or collection-initializer syntax. Elements can be accessed by passing an index e.g.  myList[0] . Indexes start from zero. List<T>  performs faster and less error-prone than the  ArrayList . Creating a List The  List<T>  is a ge...