/// <summary>
        /// Serialize the enumeration, serializing each element
        /// </summary>
        /// <param name="_collection">The collection that is to be enumerated</param>
        /// <param name="_parentNode">The XmlNode to receive the elements</param>
        /// <param name="_serializer">The framework controlling the serialization</param>
        private static void SerializeEnumeration(object _collection, XmlElement _parentNode, CSerializer _serializer)
        {
            var elementName = _serializer.GetNameForCollectionElement();
            var e           = GetEnumerator(_collection);

            while (e.MoveNext())
            {
                var element = e.Current;
                _serializer.FrameworkSerialize(elementName, element, _parentNode, typeof(TElementType));
            }
        }
        /// <summary>
        /// Construct the recursive serializer with basic information about its environment
        /// </summary>
        /// <param name="_array">The array that its going to serialize</param>
        /// <param name="_xmlToAddTo">The XML node that the array data is to be added to</param>
        /// <param name="_serializer">
        /// The serializer that will handle serialization of array elements
        /// </param>
        internal CArraySerializationHelper(Array _array, XmlElement _xmlToAddTo, CSerializer _serializer)
        {
            m_array       = _array;
            m_arrayType   = _array.GetType().GetElementType();
            m_xmlToAddTo  = _xmlToAddTo;
            m_serializer  = _serializer;
            m_elementName = _serializer.GetNameForCollectionElement();

            var rank = m_array.Rank;

            m_lengths     = new int[rank];
            m_lowerBounds = new int[rank];
            m_indicies    = new int[rank];

            GenerateAttributeInfo();

            EstablishSimpleElementProcessing();
        }
        /// <summary>
        /// Serialize a generic collection to a parent Xml element
        /// </summary>
        /// <param name="_object">The object (collection) to serialize</param>
        /// <param name="_useType">Treat the "_object" parameter as if it were of this type</param>
        /// <param name="_parentElement">The XML element that is to receive the collection as Xml data</param>
        /// <param name="_serializer">The Serializer framework object in charge of serializing the collection</param>
        /// <returns>TRUE unless the collection is not supposed to be treated like an "interface"</returns>
        public bool Serialize(object _object, Type _useType, XmlElement _parentElement, CSerializer _serializer)
        {
            if (!ATreatAsInterface.TreatAsInterface(_serializer))
            {
                return(false);
            }

            var oType = _useType;

            if (oType == null)
            {
                oType = _object.GetType();
            }

            if (oType == null)
            {
                throw new XSerializationError(
                          "When serializing a generic collection, the actual Type of the collection could not be found.");
            }

            var expectedTypes = oType.GetGenericArguments();

            if (expectedTypes.Length != NumberOfExpectedTypes)
            {
                throw new XSerializationError("The Type '" + oType.FullName + "' has " + expectedTypes.Length +
                                              " generic arguments when it is required to have exactly " + NumberOfExpectedTypes + ".");
            }

            var elementName = _serializer.GetNameForCollectionElement();

            foreach (var element in GetCollectionElements(_object))
            {
                AddElementToXml(elementName, element, _parentElement, expectedTypes, _serializer);
            }

            return(true);
        }