Is the LinkedList in .NET a circular linked list?

后端 未结 5 1436
隐瞒了意图╮
隐瞒了意图╮ 2021-02-05 06:56

I need a circular linked list, so I am wondering if LinkedList is a circular linked list?

5条回答
  •  不思量自难忘°
    2021-02-05 07:31

    A quick solution to using it in a circular fashion, whenever you want to move the "next" piece in the list:

    current = current.Next ?? current.List.First;
    

    Where current is LinkedListNode.

提交回复
热议问题