List<String>A_Word=newList<String>();//字(A)
List<Double>A_Term=newList<Double>();//特徵值(A)
Int32A_Word_num=0;//字數(A)
List<String>B_Word=newList<String>();//字(B)
List<Double>B_Term=newList<Double>();//特徵值(B)
Int32B_Word_num=0;//字數(B)
//DoublexSquare_critical;
//DoublexSquare_statistics;
Int32[]_Flag=newInt32[]{0,0};//_Flag[0].._Testing,_Flag[1].._Training
while(_Flag[0]!=_Testing._Term.Count&&_Flag[1]!=this._Training[a]._Term.Count)
Int32_Compare=String.Compare(_Testing._Term[_Flag[0]],this._Training[a]._Term[_Flag[1]]);
if(_Compare<0)
B_Word.Add(_Testing._Term[_Flag[0]]);
B_Term.Add(_Testing._Value[_Flag[0]]);
_Flag[0]+=1;
elseif(_Compare>0)
A_Word.Add(this._Training[a]._Term[_Flag[1]]);
A_Term.Add(this._Training[a]._Value[_Flag[1]]);
_Flag[1]+=1;
A_Word.Add(this._Training[a]._Term[_Flag[1]]);
B_Word.Add(_Testing._Term[_Flag[0]]);
A_Term.Add(this._Training[a]._Value[_Flag[1]]);
B_Term.Add(_Testing._Value[_Flag[0]]);
_Flag[0]+=1;
_Flag[1]+=1;
while(_Flag[0]!=_Testing._Term.Count)
B_Word.Add(_Testing._Term[_Flag[0]]);
B_Term.Add(_Testing._Value[_Flag[0]]);
_Flag[0]+=1;
while(_Flag[1]!=this._Training[a]._Term.Count)
A_Word.Add(this._Training[a]._Term[_Flag[1]]);
A_Term.Add(this._Training[a]._Value[_Flag[1]]);
_Flag[1]+=1;

我的整個程式執行到上面這段就會跳出
"索引超出範圍必須為非負數且小於集合的大小參數名稱index"

<pre class="c" name="code">Performance_Evaluation_kNN _Performance_Evaluation_kNN =
                        new Performance_Evaluation_kNN(
                            this._Training,
                            Threshold,
                            "Chi-Square");
            foreach (var q in Directory.GetDirectories(Path.Combine(Path.Combine(Application.StartupPath, "Data"), "Category")))
                DirectoryInfo _DirectoryInfo = new DirectoryInfo(q);
                foreach (var q2 in Directory.GetDirectories(Path.Combine(q, "Testing")))
                    //--------------------------------------------------------------
                    List<String> _kNN_Category = new List<String>();
                    List<Double> _kNN_Value = new List<Double>();
                    Feature_kNN _Testing = new Feature_kNN(q2, _DirectoryInfo.Name);