为什么没有LinkedList? [英] Why no LinkedList?
问题描述
为什么.NET中没有LinkedList?
标记和扫描GC算法是否存在大量
链接数据的问题?
LinkedList是非常重要的,你有大量的列表并附加一个新的
元素你只是创建这个objekt并设置一个引用,而不是
arraylist你必须复制整个数组,并用双倍大小的
创建一个新数组。
另外删除ArrayList中的元素是一个非常昂贵的
操作:删除元素后面的所有元素都必须被复制以填补
的漏洞。使用LinkedList你只需重新链接到元素即可删除
它们之间的所有内容。
我希望Whidbey提供一个LinkedList但我查看了
beta,什么都没有。
那么这个决定背后的原因是什么?
-
cody
[免费软件,游戏和幽默]
www.deutronium.de.vu || www.deutronium.tk
Cody:
在幕后,它们在.NET中被广泛使用,你可以轻松地自己编写代码。回到C ++的旧时代,我不得不自己编写
,所以我在C#中做了同样的事情只是为了好玩。如果你搜索google的Linked LIst
C#有数百个例子......
http://csharpcomputing.com/Tutorials/Lesson9.htm
也许我对ArrayLists错过了你的观点......他们根本不需要使用数组,所以我可能会误解你的观点。
你能解释一下这个部分吗? c我不认为我会关注你。
" cody" < PL ********** @ gmx.de>在消息中写道
新闻:#c ************** @ TK2MSFTNGP11.phx.gbl ...为什么不是''在.NET中有一个LinkedList吗?
标记和扫描GC算法是否存在大量链接数据的问题?
一个LinkedList非常重要,因为你有巨大的列出并添加一个新的
元素,您只需创建此objekt并设置一个引用,而不是
arraylist,您必须复制整个数组并创建一个双倍大小的新数组。
另外删除ArrayList中的元素是一项非常昂贵的操作:删除元素后面的所有元素都必须复制到
填充空洞。使用LinkedList你只需重新链接到元素即可删除它们之间的所有内容。
我希望Whidbey提供一个LinkedList,但我查看了
测试版,没有任何内容。
那么这个决定背后的原因是什么?
-
[免费软件,游戏和幽默]
www.deutronium.de.vu || www.deutronium.tk
Why isn''t there a LinkedList in .NET?
Was the reason that the mark&sweep GC algorithm has problems with heavily
linked data?
A LinkedList is very important is you have huge lists and append a new
element you just create this objekt and set a reference in contrast to an
arraylist where you have to copy the whole array and create a new one with
the double size.
Additionally removing elements in an ArrayList is a very expensive
operation: all elements behind the removed element has to be copied to fill
the hole. With LinkedList you just have to relink to element to remove
everything between them.
I was hoping that Whidbey would provide a LinkedList but I looked in the
beta and there was nothing.
So what are the reasons behind this decision?
--
cody
[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
Cody:
Behind the scenes they are used all over the place in .NET and you can
easily code one yourself. Back in the old days of C++ I had to write my own
so I did the same in C# just for fun. If you search google for Linked LIst
C# there are hundreds of examples...
http://csharpcomputing.com/Tutorials/Lesson9.htm
Maybe I"m missing your point with ArrayLists though...they don''t necessitate
the use of an Array at all, so I''m probably misunderstanding your point.
Can you explain that part a little more b/c I don''t think I follow you.
"cody" <pl*************************@gmx.de> wrote in message
news:#c**************@TK2MSFTNGP11.phx.gbl...Why isn''t there a LinkedList in .NET?
Was the reason that the mark&sweep GC algorithm has problems with heavily
linked data?
A LinkedList is very important is you have huge lists and append a new
element you just create this objekt and set a reference in contrast to an
arraylist where you have to copy the whole array and create a new one with
the double size.
Additionally removing elements in an ArrayList is a very expensive
operation: all elements behind the removed element has to be copied to fill the hole. With LinkedList you just have to relink to element to remove
everything between them.
I was hoping that Whidbey would provide a LinkedList but I looked in the
beta and there was nothing.
So what are the reasons behind this decision?
--
cody
[Freeware, Games and Humor]
www.deutronium.de.vu || www.deutronium.tk
这篇关于为什么没有LinkedList?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!