i got try using sortedlist, but it give me error.
here is my coding:
private void FPConstruction()
{
HashSet hsfP2 = new HashSet(hsfP1);
HashSet hsfP3 = new HashSet();
List storehsfP = new List();
SortedList FPCount = new SortedList();
for (int i = 0; i < FPArray.Count; i++)
{
foreach (string k in FPArray[i].ToString().Split(' '))
{
hsfP3.Add(k);
}
var clone2 = new HashSet(hsfP2);
hsfP2.IntersectWith(hsfP3);
foreach (string v in hsfP2)
{
storehsfP.Add(v);
}
hsfP2 = clone2;
hsfP3.Clear();
}
string[] FpStrArray = storehsfP.ToArray();
string[] FPArray2 = new string[FPArray.Count];
int[] lens1 = new int[FPArray.Count];
int indexs1 = 0;
foreach (string f in FPArray)
{
lens1[indexs1] = f.Replace(" ", "").Length;
indexs1++;
}
indexs1 = 0;
int indexs2 = 0;
string[] TemPlc = new string[lens1[0]];
foreach (string w in FpStrArray)
{
if (indexs2 < lens1[indexs1])
{
TemPlc[indexs2] = w;
indexs2++;
}
else
{
FPArray2[indexs1] = String.Join(" ", TemPlc);
indexs1++;
TemPlc = new string[lens1[indexs1]];
TemPlc[0] = w;
indexs2 = 1;
}
}
FPArray2[indexs1] = String.Join(" ", TemPlc);
string message3 = String.Join("\r\n", FPArray2);
DisplayResult.Clear();
DisplayResult.AppendText(message3);
}
hope someone can help me...thanks you so much.
VulpesPosted Apr 8, 2011, 4:46 PM
VulpesPosted Apr 12, 2011, 4:51 AM
foreach (string g in FPArray2)
{
if (g == null) continue;
if (!(Fplist.ContainsKey(g)))
{
Fplist.Add(g, 1);
}
else
{
int count = (int)Fplist[g];
Fplist[g] = count + 1;
}
}
Sin YeePosted Apr 11, 2011, 9:36 PM
VulpesPosted Apr 11, 2011, 3:46 PM
Sin YeePosted Apr 11, 2011, 12:58 PM
" if (!(Fplist.ContainsKey(g)))" what is the wrong....?
Sin YeePosted Apr 8, 2011, 1:58 PM
matt cuprykPosted Apr 8, 2011, 1:53 PM
Sin YeePosted Apr 8, 2011, 1:43 PM
matt cuprykPosted Apr 8, 2011, 1:30 PM