0

First I'm sorry for my bad English, then my question;

I know that there are many questions like this one, in here, but I didn't find a straight answer. Is List<T> implemented using some sort of "linked list" mechanism? Or it is just an over-engineered array?

I'm interested in performance issues of lists, like sorting, inserting and deleting items. E.g. for insertion action, 'linked list' just defines some new connections, but array needs to shift its values. What about list?

4

4 に答える 4

3

私はそれが過剰に設計された配列であると言うでしょう。リンク リストの場合は、 が必要LinkedList<T>です。詳細については、これLinkedList<T>を読んでください

于 2013-07-28T02:57:21.310 に答える
2

いいえ、List は連結リストではなく、厳密に型指定された便利な配列です。エンジニアド アレイとは呼びませんが、C# 2.0 から導入された最高の機能の 1 つです。ジェネリック リストのパフォーマンスが懸念される場合は、ユース ケースに基づいて最適化できますが、巨大なリストでも挿入するだけでそれほど時間はかかりません。

于 2013-07-28T04:28:25.123 に答える