不可变的列表 [英] Immutable Lists

查看:88
本文介绍了不可变的列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

实现这一目标的最佳方法是什么,或者这是一个坏主意?

What''s the best way to achieve this, or is this a bad idea?

推荐答案



< ph ******** @ gmail.com写信息

新闻:11 **************** ******@h3g2000cwc.googlegro ups.com ...

|实现这一目标的最佳方法是什么,或者这是一个坏主意?


从CollectionBase派生而不添加Add方法。超级轻松实现。
实施。


我认为这不是一个坏主意。如果你有需要的话。


-

Ignacio Machin

machin AT laceupsolutions com
Hi,
<ph********@gmail.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
| What''s the best way to achieve this, or is this a bad idea?

Derive from CollectionBase and do not add a Add method. Super easy to
implement.

I do not think it''s a bad idea. if you have the need for it .

--
Ignacio Machin
machin AT laceupsolutions com


在2.0中有ReadOnlyCollection< Twhich为你做这件事。


Marc
In 2.0 there is ReadOnlyCollection<Twhich does this for you.

Marc


也许更好的是,从ReadOnlyCollectionBase派生而且你已经完成了。


Ignacio Machin(.NET / C#MVP)" < machin TA laceupsolutions.comha scritto

nel messaggio新闻:Ol **************** @ TK2MSFTNGP06.phx.gbl ...
Maybe better yet, derive from ReadOnlyCollectionBase and you are quite done.

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comha scritto
nel messaggio news:Ol****************@TK2MSFTNGP06.phx.gbl...




< ph ******** @ gmail.comwrote in message

新闻:11 ********************** @ h3g2000cwc.googlegro ups.com ...

|实现这一目标的最佳方法是什么,或者这是一个坏主意?


从CollectionBase派生而不添加Add方法。超级轻松实现。
实施。


我认为这不是一个坏主意。如果你有需要的话。


-

Ignacio Machin

machin AT laceupsolutions com

Hi,
<ph********@gmail.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
| What''s the best way to achieve this, or is this a bad idea?

Derive from CollectionBase and do not add a Add method. Super easy to
implement.

I do not think it''s a bad idea. if you have the need for it .

--
Ignacio Machin
machin AT laceupsolutions com



这篇关于不可变的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆