コード例 #1
0
 /// <summary>
 ///		Creates a read-only wrapper for a
 ///     <c>LongCollection</c> instance.
 /// </summary>
 /// <returns>
 ///     An <c>LongCollection</c> wrapper that is read-only.
 /// </returns>
 public static LongCollection ReadOnly(LongCollection list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new ReadOnlyLongCollection(list));
 }
コード例 #2
0
 /// <summary>
 ///		Creates a synchronized (thread-safe) wrapper for a
 ///     <c>LongCollection</c> instance.
 /// </summary>
 /// <returns>
 ///     An <c>LongCollection</c> wrapper that is synchronized (thread-safe).
 /// </returns>
 public static LongCollection Synchronized(LongCollection list)
 {
     if (list == null)
     {
         throw new ArgumentNullException("list");
     }
     return(new SyncLongCollection(list));
 }
コード例 #3
0
        /// <summary>
        ///	Creates a deep copy of the <see cref="LongCollection"/>.
        /// </summary>
        public virtual LongCollection Clone()
        {
            LongCollection newColl = new LongCollection(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);
        }
コード例 #4
0
        /// <summary>
        ///		Adds the elements of another <c>LongCollection</c> to the current <c>LongCollection</c>.
        /// </summary>
        /// <param name="x">The <c>LongCollection</c> whose elements should be added to the end of the current <c>LongCollection</c>.</param>
        /// <returns>The new <see cref="LongCollection.Count"/> of the <c>LongCollection</c>.</returns>
        public virtual int AddRange(LongCollection 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);
        }
コード例 #5
0
            public override int AddRange(LongCollection x)
            {
                int result = 0;

                rwLock.AcquireWriterLock(timeout);

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

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