我有一個像下面結構,當我做初始化:列表<element>初始化火災「進程被終止由於StackOverflowException」
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火災過程被終止由於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
如果我有一塊錢,每次我們看到這個問題時我會是一個富有的人...! – Sean 2010-03-24 20:48:17