Esempio n. 1
0
        /// <summary>
        ///	Creates a read-only wrapper for a <c>PluginCollection</c> instance.
        /// </summary>
        /// <param name="list">list to create a readonly wrapper arround</param>
        /// <returns>
        /// A <c>PluginCollection</c> wrapper that is read-only.
        /// </returns>
        public static PluginCollection ReadOnly(PluginCollection list)
        {
            if (list == null)
            {
                throw new ArgumentNullException("list");
            }

            return(new ReadOnlyPluginCollection(list));
        }
Esempio n. 2
0
        /// <summary>
        /// Creates a shallow copy of the <see cref="PluginCollection"/>.
        /// </summary>
        /// <returns>A new <see cref="PluginCollection"/> with a shallow copy of the collection data.</returns>
        public virtual object Clone()
        {
            PluginCollection newCol = new PluginCollection(m_count);

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

            return(newCol);
        }
Esempio n. 3
0
        /// <summary>
        /// Adds the elements of another <c>PluginCollection</c> to the current <c>PluginCollection</c>.
        /// </summary>
        /// <param name="x">The <c>PluginCollection</c> whose elements should be added to the end of the current <c>PluginCollection</c>.</param>
        /// <returns>The new <see cref="PluginCollection.Count"/> of the <c>PluginCollection</c>.</returns>
        public virtual int AddRange(PluginCollection 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);
        }
Esempio n. 4
0
 public override int AddRange(PluginCollection x)
 {
     throw new NotSupportedException("This is a Read Only Collection and can not be modified");
 }
Esempio n. 5
0
 internal ReadOnlyPluginCollection(PluginCollection list) : base(Tag.Default)
 {
     m_collection = list;
 }
Esempio n. 6
0
 /// <summary>
 /// Initializes a new instance of the <c>Enumerator</c> class.
 /// </summary>
 /// <param name="tc"></param>
 internal Enumerator(PluginCollection tc)
 {
     m_collection = tc;
     m_index      = -1;
     m_version    = tc.m_version;
 }
Esempio n. 7
0
 /// <summary>
 /// Initializes a new instance of the <c>PluginCollection</c> class
 /// that contains elements copied from the specified <c>PluginCollection</c>.
 /// </summary>
 /// <param name="c">The <c>PluginCollection</c> whose elements are copied to the new collection.</param>
 public PluginCollection(PluginCollection c)
 {
     m_array = new IPlugin[c.Count];
     AddRange(c);
 }