课程: C# Algorithms

今天就学习课程吧!

今天就开通帐号,24,700 门业界名师课程任您挑!

Common linked list operations in C#

Common linked list operations in C# - C#教程

课程: C# Algorithms

Common linked list operations in C#

- [Instructor] With an understanding of the Linked List Data Structure we can begin to work with linked lists and C#. In fact, we can use the built-in linked list type defined in the system.collections.generic namespace. The linked list type is generic because it can hold many different types of data, including custom object data. All we have to do is specify it upon list creation. To create a linked list we use the linked list data type. This linked list will contain strings, so we'll put string in the arrow brackets. We could specify integer or double or accustomed type, but for this example, we'll be using strings. Let's add some data to this linked list. We can add data to the back with add last. We can also add data to the front with add first. Let's see, use add last and add a few strings to the list. Now that we have some data, we can look at some of the built-in operations. We can use the contains method to see if a certain piece of data is in the list. Let's print it out to…

内容