【发布时间】:2010-03-24 20:43:06
【问题描述】:
我有如下结构,当我进行初始化时:
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
调试器触发 由于 StackOverflowException 而终止进程 :/ 知道为什么这个集合会触发这个异常吗?
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
【问题讨论】:
-
如果我每次看到这个问题都能得到一块钱,我会成为一个有钱人......!
标签: c# list stack-overflow