public readonly T? Value;
public readonly ListNode<T>? Next;
public ListNode(T? value, ListNode<T>? next = null)
public ListNode<T>? First = null;
ListNode<T>? Current = null;
public ListNode<T>? Add(T value, ListNode<T>? current = null)
ListNode<T> node = new(value);
First = Current = Add(value, First);
if (current.Next != null)
ListNode<T> node = new(current.Value, Add(value, current.Next));
ListNode<T> nodeNext = new(value, null);
ListNode<T> node = new(current.Value, nodeNext);
public ListOfNodes<T>? AddList(ListOfNodes<T> secondList)
ListOfNodes<T> newList = new();
ListNode<T> current = this.First;
for (int i = 0; i < this.Count; i++)
newList.Add(current.Value);
current = secondList.First;
for (int i = 0; i < secondList.Count; i++)
newList.Add(current.Value);
public ListOfNodes<T>? ChangeOn(int indexToChange, T value)
ListOfNodes<T> list = new();
ListNode<T> current = First;
for (int i = 0; i < indexToChange; i++)
for (int i = indexToChange + 1; i < Count; i++)
ListOfNodes<int> nodes = new ListOfNodes<int>();
ListOfNodes<int> nodes2 = new ListOfNodes<int>();
ListOfNodes<int> nodes3 = nodes.AddList(nodes2);
ListNode<int> current = nodes.First;
for (int i = 0; i < nodes.Count; i++)
Console.Write(current.Value + " ");
for (int i = 0; i < nodes2.Count; i++)
Console.Write(current.Value + " ");
for (int i = 0; i < nodes3.Count; i++)
Console.Write(current.Value + " ");