相关疑难解决方法(0)

什么是合适的NHibernate/Iesi.Collections.Generic.ISet <T>替换?

在最新版本的Iesi.Collections中缺少Iesi.Collections.Generic.ISet.似乎有三种选择:

  1. LinkedHashSet
  2. ReadOnlySet
  3. SynchronizedSet

Iesi.Collections.Generic.ReadOnlySet似乎最接近ISet,文档说明:

... although it's advertised as immutable it really isn't. 
Anyone with access to the wrapped set can still change the set. 
Run Code Online (Sandbox Code Playgroud)

似乎ReadOnlySet是ISet的最佳替代品?目前,实现是通过公共方法向集合添加项目,因此它似乎是最合适的.替代方案(IList,bag?)似乎需要更多资源或不那么快/有效)?还有更好的选择吗?(该列表不应该有重复,可以手动验证)

我会做的事情如下:

public virtual ISet<MyClass> MyClass
{
    get { return this.myClass }
}

public virtual void AddItem(MyClass item)
{
    ... // Null checks and initialize ISet if null
    myClass.Add(item)
}
Run Code Online (Sandbox Code Playgroud)

基本上它归结为替代品,是否存在没有负面影响的替代品,如速度等?

c# nhibernate iesi-collections

6
推荐指数
1
解决办法
3503
查看次数

标签 统计

c# ×1

iesi-collections ×1

nhibernate ×1