CKTIS / C#
System.Collections.Generic.LinkedList: praktična referenca
System.Collections.Generic.LinkedList: praktična referenca: LinkedList<T> je dvojno povezan seznam s konstantnim vstavljanjem ali odstranjevanjem, ko je vozlišče znano.
Različica: .NET API; verified on .NET 10.0.14
Sintaksa
System.Collections.Generic.LinkedList /* select a documented member or constructor */LinkedList je dvojno povezan seznam s konstantnim vstavljanjem ali odstranjevanjem, ko je vozlišče znano.
Uporabite ga, ko pogosto premikate znana vozlišča in ne potrebujete naključnega dostopa po indeksu.
Iskanje vrednosti je linearno in vsak LinkedListNode lahko hkrati pripada samo enemu seznamu.
First in Last sta pri praznem seznamu null, odstranjenemu vozlišču pa se List počisti.
Celoten program dejansko uporabi System.Collections.Generic.LinkedList; natančno pričakovani stdout je 2,3.
Primeri
using System;
using System.Buffers;
using System.Collections.Concurrent;
using System.Collections.Frozen;
using System.Collections.Generic;
using System.Collections.Immutable;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Linq.Expressions;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Channels;
using System.Threading.Tasks;
using Number = System.Int32;
var list = new LinkedList<int>();
list.AddFirst(2);
list.AddLast(3);
Console.WriteLine($"{list.First!.Value},{list.Last!.Value}");
Rezultat
2,3
Celoten program dejansko uporabi `System.Collections.Generic.LinkedList`; natančno pričakovani stdout je `2,3`.