VB.Net | When should I use a List vs a LinkedList?

Here, we are going to learn when should I use a List vs a LinkedList in VB.Net?
Submitted by Nidhi, on December 23, 2020 [Last updated : March 08, 2023]

List or LinkedList – What to use in VB.Net?

List<T> and LinkedList<T> are data structures, both are used to store data elements. The List data structure uses the system array-like Object[] to store the data elements. We can increase the size of the list when we needed. Whereas Linked List stores the data in the form of nodes, A node contains two parts data and pointer. The data part is used to store the item, and the pointer part stores the address of the next node.

The execution of LinkedList<T> is slower than a list. The LinkedList<T> is efficient only when we sequentially access data items. It is more expensive when we access the item randomly. Because we need to walk from start to end of the linked list to search the item.

The implementation of List in the .NET framework using an array that's why it is faster in a random search.




Comments and Discussions!

Load comments ↻






Copyright © 2024 www.includehelp.com. All rights reserved.