예제 #1
0
 /// <summary>
 /// 从特定的 <see cref="Array"/> 索引处开始,将 <see cref="SetBase{T}"/>
 /// 的元素复制到一个 <see cref="Array"/> 中。
 /// </summary>
 /// <param name="array">从 <see cref="SetBase{T}"/>
 /// 复制的元素的目标位置的一维 <see cref="System.Array"/>。
 /// <paramref name="array"/> 必须具有从零开始的索引。</param>
 /// <param name="index"><paramref name="array"/> 中从零开始的索引,在此处开始复制。</param>
 /// <exception cref="ArgumentNullException"><paramref name="array"/> 为 <c>null</c>。</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="index"/> 小于零。</exception>
 /// <exception cref="ArgumentException"><paramref name="array"/> 是多维的。</exception>
 /// <exception cref="ArgumentException"><see cref="SetBase{T}"/>
 /// 中的元素数目大于从 <paramref name="index"/> 到目标 <paramref name="array"/>
 /// 末尾之间的可用空间。</exception>
 /// <exception cref="ArgumentException">源 <see cref="SetBase{T}"/>
 /// 的类型无法自动转换为目标 <paramref name="array"/> 的类型。</exception>
 void ICollection.CopyTo(Array array, int index)
 {
     CollectionHelper.CopyTo(this, array, index);
 }
예제 #2
0
 /// <summary>
 /// 使用指定的字典初始化 <see cref="KeyedCollectionBase{TKey, TItem}"/> 类的新实例。
 /// </summary>
 /// <param name="dict">用于保存项的字典。</param>
 /// <exception cref="ArgumentNullException"><paramref name="dict"/> 为 <c>null</c>。</exception>
 protected KeyedCollectionBase(IDictionary <TKey, TItem> dict)
     : base(CollectionHelper.GetDictValues(dict))
 {
     Contract.Requires(dict != null);
     this.dict = dict;
 }
예제 #3
0
 /// <summary>
 /// 从特定的 <see cref="Array"/> 索引处开始,将 <see cref="SetBase{T}"/>
 /// 的元素复制到一个 <see cref="Array"/> 中。
 /// </summary>
 /// <param name="array">从 <see cref="SetBase{T}"/>
 /// 复制的元素的目标位置的一维 <see cref="Array"/>。
 /// <paramref name="array"/> 必须具有从零开始的索引。</param>
 /// <param name="arrayIndex"><paramref name="array"/> 中从零开始的索引,在此处开始复制。</param>
 /// <exception cref="System.ArgumentNullException">
 /// <paramref name="array"/> 为 <c>null</c>。</exception>
 /// <exception cref="System.ArgumentOutOfRangeException">
 /// <paramref name="arrayIndex"/> 小于零。</exception>
 /// <exception cref="System.ArgumentException">
 /// <paramref name="array"/> 是多维的。</exception>
 /// <exception cref="System.ArgumentException"><see cref="SetBase{T}"/>
 /// 中的元素数目大于从 <paramref name="arrayIndex"/> 到目标 <paramref name="array"/>
 /// 末尾之间的可用空间。</exception>
 public void CopyTo(T[] array, int arrayIndex)
 {
     CollectionHelper.CopyTo(this, array, arrayIndex);
 }
예제 #4
0
 /// <summary>
 /// 确定 <see cref="ReadOnlyList{T}"/> 是否包含指定对象。
 /// </summary>
 /// <param name="value">要在 <see cref="ReadOnlyList{T}"/> 中定位的对象。</param>
 /// <returns>如果在 <see cref="ReadOnlyList{T}"/> 中找到 <paramref name="value"/>,
 /// 则为 <c>true</c>;否则为 <c>false</c>。</returns>
 bool IList.Contains(object value)
 {
     return(CollectionHelper.IsCompatible <T>(value) && this.Contains((T)value));
 }