class GenListDemo { static void Main() {
// .
List<char> 1st = new List<char>();
Console.WriteLine(" : " + lst.Count);
Console.WriteLine();
Console.WriteLine(" 6 ");
// .
1st.Add('');
1st.Add(1 *);
1st.Add('');
1st.Add(11);
1st.Add('D');
1st.Add('F');
Console.WriteLine(" : " + lst.Count);
// ,
// .
Console.Write(" : "); for (int i=0; i < lst.Count;. i++)
Console.Write(1st[i] + " ");
Console.WriteLine("\n");
Console.WriteLine(" 2 ");
// .
1st.Remove('F');
1st.Remove('1);
Console.WriteLine(" : " + lst.Count);
// , foreach. Console.Write(": "); foreach(char in 1st)
Console.Write( + " ");
Console.WriteLine("\n");
Console.WriteLine(" 20 ");
// , // , for(int i=0; i < 20; i++)
1st.Add((char) ('a1 + i));
Console.WriteLine(" : " + 1st.Capacity);
Console.WriteLine(" 20 : " + 1st.Count);
Console.Write(": ");
Foreach(char in 1st)
Console.Write( + " ");
Console.WriteLine("\n");
// ,
// .
Console.WriteLine(" "); 1st [0] = 1X'; lst[l] = ' Y';
1st[2] = 1Z1;
Console.Write(": "); foreach(char in 1st)
Console.Write( + " ");
Console.WriteLine ();
// - // .
// lst.Add(99); // , char!
}
}
, .
:
6 : 6 : D F
2 : 4 : D
20 : 32
20 : 24 : CEBDabcdefghij klmnopqrst
: XYZDabcdefghij klmnopqrst
LinkedList<T>
LinkedList<T> . ICollection, ICollection<T>, IEnumerable, IEnumerable<T>, ISerializable IDeserializationCallback. . LinkedList<T> .
|
|
Public LinkedListO
public LinkedList(IEnumerable<T> collection)
, , collection.
, LinkedList<T> , , . LinkedListNode<T>. LinkedListNode<T> .
public LinkedListNode<T> Next { get; } public LinkedListNode<T> Previous { get; } public LinkedList<T> List { get; } public T Value { get; set; }
Next Previous , . , . List. Value , .
LinkedList<T> . . 25.16 . , LinkedList<T> , , , . .
public LinkedListNode<T> First { get; } public LinkedListNode<T> Last { get; }