nicko       2005/01/28 12:46:29

  Modified:    src/Appender AppenderCollection.cs
  Log:
  Added ToArray() to AppenderCollection. Added missing ICollection.CopyTo to 
ReadOnlyAppenderCollection.
  
  Revision  Changes    Path
  1.11      +24 -2     logging-log4net/src/Appender/AppenderCollection.cs
  
  Index: AppenderCollection.cs
  ===================================================================
  RCS file: /home/cvs/logging-log4net/src/Appender/AppenderCollection.cs,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- AppenderCollection.cs     17 Jan 2005 20:18:41 -0000      1.10
  +++ AppenderCollection.cs     28 Jan 2005 20:46:29 -0000      1.11
  @@ -546,6 +546,20 @@
                        this.Capacity = m_count;
                }
   
  +             /// <summary>
  +             /// Return the collection elements as an array
  +             /// </summary>
  +             /// <returns>the array</returns>
  +             public virtual IAppender[] ToArray()
  +             {
  +                     IAppender[] resultArray = new IAppender[m_count];
  +                     if (m_count > 0)
  +                     {
  +                             Array.Copy(m_array, 0, resultArray, 0, m_count);
  +                     }
  +                     return resultArray;
  +             }
  +
                #endregion
   
                #region Implementation (helpers)
  @@ -591,7 +605,10 @@
   
                void ICollection.CopyTo(Array array, int start)
                {
  -                     Array.Copy(m_array, 0, array, start, m_count);
  +                     if (m_count > 0)
  +                     {
  +                             Array.Copy(m_array, 0, array, start, m_count);
  +                     }
                }
   
                #endregion
  @@ -731,7 +748,7 @@
                #region Nested Read Only Wrapper class
   
                /// <exclude/>
  -             private sealed class ReadOnlyAppenderCollection : 
AppenderCollection
  +             private sealed class ReadOnlyAppenderCollection : 
AppenderCollection, ICollection
                {
                        #region Implementation (data)
   
  @@ -760,6 +777,11 @@
                                m_collection.CopyTo(array,start);
                        }
   
  +                     void ICollection.CopyTo(Array array, int start)
  +                     {
  +                             ((ICollection)m_collection).CopyTo(array, 
start);
  +                     }
  +
                        public override int Count
                        {
                                get { return m_collection.Count; }
  
  
  

Reply via email to