Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> C#

LinkedList ใน C#

Namespace System.Collections.Generic มีคลาส LinkedList<T> ใช้แทรกและลบข้อมูลได้เร็ว รองรับข้อมูลซ้ำ

ตัวอย่าง

using System;
using System.Collections.Generic;
class Demo {
    static void Main() {
        LinkedList<string> l = new LinkedList<string>();
        l.AddLast("one");
        l.AddLast("two");
        l.AddLast("three");
        foreach(var ele in l) { Console.WriteLine(ele); }
    }
}

ผลลัพธ์

one
two
three