ToString() public method

Overrides the default method and returns a System.String that represents this instance
public ToString ( ) : string
return string
        private void recursive_get_existing_paths(XmlReader readerXml, Stack<GenericXmlNode> currentStack, Dictionary<string, string> pathExistenceCheck, List<GenericXmlPath> returnValue )
        {
            // Create the list of nodes to this point from the stack
            List<GenericXmlNode> currentReverseList = currentStack.ToList();

            // THis is now on THIS element, so move to the next, unless there were none
            if (!readerXml.Read()) return;

            // Check to see if this node has been added yet
            // Create the path for this
            GenericXmlPath currentPath = new GenericXmlPath();
            for (int j = currentReverseList.Count - 1; j >= 0; j--)
            {
                currentPath.PathNodes.Add(currentReverseList[j]);
            }

            // Was this already added?
            string currentPathString = currentPath.ToString();
            if (!pathExistenceCheck.ContainsKey(currentPathString))
            {
                pathExistenceCheck[currentPathString] = currentPathString;
                returnValue.Add(currentPath);
            }

            // First, handle any attributes
            if (readerXml.HasAttributes)
            {
                // Create the list of nodes to this point
                for( int i = 0 ; i < readerXml.AttributeCount ; i++ )
                {
                    // Move to this attribute
                    readerXml.MoveToAttribute(i);

                    // Create the path for this
                    GenericXmlPath thisPath = new GenericXmlPath();
                    for (int j = currentReverseList.Count - 1; j >= 0; j--)
                    {
                        thisPath.PathNodes.Add(currentReverseList[j]);
                    }
                    thisPath.AttributeName = readerXml.Name;

                    // Was this already added?
                    string pathString = thisPath.ToString();
                    if (!pathExistenceCheck.ContainsKey(pathString))
                    {
                        pathExistenceCheck[pathString] = pathString;
                        returnValue.Add(thisPath);
                    }
                }

                // Move back to the main element after handing the attributes
                readerXml.MoveToElement();
            }

            //// THis is now on THIS element, so move to the next, unless there were none
            //if (!readerXml.Read()) return;

            //// Is there actual text for this element
            //if ( !String.IsNullOrEmpty(readerXml.Value))
            //{
            //    // Create the path for this
            //    GenericXmlReaderMapperPath thisPath = new GenericXmlReaderMapperPath();
            //    for (int j = currentReverseList.Count - 1; j >= 0; j--)
            //    {
            //        thisPath.PathNodes.Add(currentReverseList[j]);
            //    }

            //    // Was this already added?
            //    string pathString = thisPath.ToString();
            //    if (!pathExistenceCheck.ContainsKey(pathString))
            //    {
            //        pathExistenceCheck[pathString] = pathString;
            //        returnValue.Add(thisPath);
            //    }
            //}

            // Now, iterate through all the child elements that may exist
            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Text)
                {
                    // Create the path for this
                    GenericXmlPath thisPath = new GenericXmlPath();
                    for (int j = currentReverseList.Count - 1; j >= 0; j--)
                    {
                        thisPath.PathNodes.Add(currentReverseList[j]);
                    }

                    // Was this already added?
                    string pathString = thisPath.ToString();
                    if (!pathExistenceCheck.ContainsKey(pathString))
                    {
                        pathExistenceCheck[pathString] = pathString;
                        returnValue.Add(thisPath);
                    }
                }

                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    // Create the node for this top-level element
                    string nodeName = readerXml.Name;
                    GenericXmlNode topNode = new GenericXmlNode { NodeName = nodeName };

                    // Add this to the stack
                    currentStack.Push(topNode);

                    // Recursively read this and all children
                    recursive_get_existing_paths(readerXml.ReadSubtree(), currentStack, pathExistenceCheck, returnValue);

                    // Since this node was handled, pop it off the stack
                    currentStack.Pop();
                }
            }
        }
        private void recursive_get_existing_paths(XmlReader readerXml, Stack <GenericXmlNode> currentStack, Dictionary <string, string> pathExistenceCheck, List <GenericXmlPath> returnValue)
        {
            // Create the list of nodes to this point from the stack
            List <GenericXmlNode> currentReverseList = currentStack.ToList();


            // THis is now on THIS element, so move to the next, unless there were none
            if (!readerXml.Read())
            {
                return;
            }

            // Check to see if this node has been added yet
            // Create the path for this
            GenericXmlPath currentPath = new GenericXmlPath();

            for (int j = currentReverseList.Count - 1; j >= 0; j--)
            {
                currentPath.PathNodes.Add(currentReverseList[j]);
            }

            // Was this already added?
            string currentPathString = currentPath.ToString();

            if (!pathExistenceCheck.ContainsKey(currentPathString))
            {
                pathExistenceCheck[currentPathString] = currentPathString;
                returnValue.Add(currentPath);
            }

            // First, handle any attributes
            if (readerXml.HasAttributes)
            {
                // Create the list of nodes to this point
                for (int i = 0; i < readerXml.AttributeCount; i++)
                {
                    // Move to this attribute
                    readerXml.MoveToAttribute(i);

                    // Create the path for this
                    GenericXmlPath thisPath = new GenericXmlPath();
                    for (int j = currentReverseList.Count - 1; j >= 0; j--)
                    {
                        thisPath.PathNodes.Add(currentReverseList[j]);
                    }
                    thisPath.AttributeName = readerXml.Name;

                    // Was this already added?
                    string pathString = thisPath.ToString();
                    if (!pathExistenceCheck.ContainsKey(pathString))
                    {
                        pathExistenceCheck[pathString] = pathString;
                        returnValue.Add(thisPath);
                    }
                }

                // Move back to the main element after handing the attributes
                readerXml.MoveToElement();
            }

            //// THis is now on THIS element, so move to the next, unless there were none
            //if (!readerXml.Read()) return;



            //// Is there actual text for this element
            //if ( !String.IsNullOrEmpty(readerXml.Value))
            //{
            //    // Create the path for this
            //    GenericXmlReaderMapperPath thisPath = new GenericXmlReaderMapperPath();
            //    for (int j = currentReverseList.Count - 1; j >= 0; j--)
            //    {
            //        thisPath.PathNodes.Add(currentReverseList[j]);
            //    }

            //    // Was this already added?
            //    string pathString = thisPath.ToString();
            //    if (!pathExistenceCheck.ContainsKey(pathString))
            //    {
            //        pathExistenceCheck[pathString] = pathString;
            //        returnValue.Add(thisPath);
            //    }
            //}



            // Now, iterate through all the child elements that may exist
            while (readerXml.Read())
            {
                if (readerXml.NodeType == XmlNodeType.Text)
                {
                    // Create the path for this
                    GenericXmlPath thisPath = new GenericXmlPath();
                    for (int j = currentReverseList.Count - 1; j >= 0; j--)
                    {
                        thisPath.PathNodes.Add(currentReverseList[j]);
                    }

                    // Was this already added?
                    string pathString = thisPath.ToString();
                    if (!pathExistenceCheck.ContainsKey(pathString))
                    {
                        pathExistenceCheck[pathString] = pathString;
                        returnValue.Add(thisPath);
                    }
                }

                if (readerXml.NodeType == XmlNodeType.Element)
                {
                    // Create the node for this top-level element
                    string         nodeName = readerXml.Name;
                    GenericXmlNode topNode  = new GenericXmlNode {
                        NodeName = nodeName
                    };

                    // Add this to the stack
                    currentStack.Push(topNode);

                    // Recursively read this and all children
                    recursive_get_existing_paths(readerXml.ReadSubtree(), currentStack, pathExistenceCheck, returnValue);

                    // Since this node was handled, pop it off the stack
                    currentStack.Pop();
                }
            }
        }