List<element> initialization fires "Process is terminated due to StackOverflowException"

Posted by netmajor on Stack Overflow See other posts from Stack Overflow or by netmajor
Published on 2010-03-24T20:43:06Z Indexed on 2010/03/24 20:53 UTC
Read the original article Hit count: 442

Filed under:
|
|

I have structs like below and when I do that initialization:

ArrayList nodesMatrix = null;
List<vertex> vertexMatrix = null;
List<bool> odwiedzone = null;
List<element> priorityQueue = null;

vertexMatrix = new List<vertex>(nodesNr + 1);
nodesMatrix = new ArrayList(nodesNr + 1);
odwiedzone = new List<bool>(nodesNr + 1);
priorityQueue = new List<element>();

arr.NodesMatrix = nodesMatrix;
arr.VertexMatrix = vertexMatrix;
arr.Odwiedzone = odwiedzone;
arr.PriorityQueue = priorityQueue; //only here i have exception

debuger fires Process is terminated due to StackOverflowException :/ Some idea why this collection fires this exception ?

private struct arrays
    {
        ArrayList nodesMatrix;

        public ArrayList NodesMatrix
        {
            get { return nodesMatrix; }
            set { nodesMatrix = value; }
        }
        List<vertex> vertexMatrix;

        public List<vertex> VertexMatrix
        {
            get { return vertexMatrix; }
            set { vertexMatrix = value; }
        }
        List<bool> odwiedzone;

        public List<bool> Odwiedzone
        {
            get { return odwiedzone; }
            set { odwiedzone = value; }
        }
        public List<element> PriorityQueue
        {
            get { return PriorityQueue; }
            set { PriorityQueue = value; }
        }


    }
    public struct element : IComparable
    {
        public double priority
        {
            get { return priority; }
            set { priority = value; }
        }
        public int node
        {
            get { return node; }
            set { node = value; }
        }
        public element(double _prio, int _node)
        {
            priority = _prio;
            node = _node;
        }

        #region IComparable Members

        public int CompareTo(object obj)
        {
            element elem = (element)obj;
            return priority.CompareTo(elem.priority);
        }

        #endregion

© Stack Overflow or respective owner

Related posts about c#

Related posts about stackoverflowexception