Ejemplo n.º 1
0
 /// <summary>
 ///		Creates a read-only wrapper for a
 ///     <c>ShortCollection</c> instance.
 /// </summary>
 /// <returns>
 ///     An <c>ShortCollection</c> wrapper that is read-only.
 /// </returns>
 public static ShortCollection ReadOnly(ShortCollection list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new ReadOnlyShortCollection(list));
 }
Ejemplo n.º 2
0
 /// <summary>
 ///		Creates a synchronized (thread-safe) wrapper for a
 ///     <c>ShortCollection</c> instance.
 /// </summary>
 /// <returns>
 ///     An <c>ShortCollection</c> wrapper that is synchronized (thread-safe).
 /// </returns>
 public static ShortCollection Synchronized(ShortCollection list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new SyncShortCollection(list));
 }
Ejemplo n.º 3
0
        /// <summary>
        ///	Creates a deep copy of the <see cref="ShortCollection"/>.
        /// </summary>
        public virtual ShortCollection Clone()
        {
            ShortCollection newColl = new ShortCollection(m_count);

            Array.Copy(m_array, 0, newColl.m_array, 0, m_count);
            newColl.m_count   = m_count;
            newColl.m_version = m_version;

            return(newColl);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///		Adds the elements of another <c>ShortCollection</c> to the current <c>ShortCollection</c>.
        /// </summary>
        /// <param name="x">The <c>ShortCollection</c> whose elements should be added to the end of the current <c>ShortCollection</c>.</param>
        /// <returns>The new <see cref="ShortCollection.Count"/> of the <c>ShortCollection</c>.</returns>
        public virtual int AddRange(ShortCollection x)
        {
            if (m_count + x.Count >= m_array.Length)
            {
                EnsureCapacity(m_count + x.Count);
            }

            Array.Copy(x.m_array, 0, m_array, m_count, x.Count);
            m_count += x.Count;
            m_version++;

            return(m_count);
        }
Ejemplo n.º 5
0
            public override int AddRange(ShortCollection x)
            {
                int result = 0;

                rwLock.AcquireWriterLock(timeout);

                try
                {
                    result = collection.AddRange(x);
                }
                finally
                {
                    rwLock.ReleaseWriterLock();
                }

                return(result);
            }
Ejemplo n.º 6
0
 /// <summary>
 ///		Initializes a new instance of the <c>ShortCollection</c> class
 ///		that contains elements copied from the specified <c>ShortCollection</c>.
 /// </summary>
 /// <param name="c">The <c>ShortCollection</c> whose elements are copied to the new collection.</param>
 public ShortCollection(ShortCollection c)
 {
     m_array = new Int16[c.Count];
     AddRange(c);
 }
Ejemplo n.º 7
0
 internal SyncShortCollection(ShortCollection list) : base(Tag.Default)
 {
     rwLock     = new System.Threading.ReaderWriterLock();
     collection = list;
 }
Ejemplo n.º 8
0
 /// <summary>
 ///		Initializes a new instance of the <c>ShortEnumerator</c> class.
 /// </summary>
 /// <param name="tc"></param>
 internal ShortEnumerator(ShortCollection tc)
 {
     m_collection = tc;
     m_index      = -1;
     m_version    = tc.m_version;
 }
Ejemplo n.º 9
0
 public override int AddRange(ShortCollection x)
 {
     throw new NotSupportedException("This is a Read Only Collection and can not be modified");
 }
Ejemplo n.º 10
0
 internal ReadOnlyShortCollection(ShortCollection list) : base(Tag.Default)
 {
     m_collection = list;
 }