this is dummy situation i can tell you...if you all doesn't catch up what i told you, i didn't know how to describe you guys....let's say, during foreach loop, i can get two value for example which is 5 and 3....from this phase, these two value, i want it automatically insert into array that names terms[]....simple enough to understand right....my purpose it insert into array because i want do comparison between that value to find a maximum value....about value i get from foreach loop just now, i extract from external source which is string[] l = strGeneratedCandidate.Split (' ');....
this strGeneratedCandidate value is 12...after passing process splittng, the value bacome 1 and 2...are you clear right now....then these value, i use in another method to find maximum value...
see code below for better understanding
private Dictionary<string, double> GenerateCandidates(Dictionary<string, double> dic_FrequentItems, Dictionary<string, double> dic_FrequentItemsL1)
{
List<clssRules> lstSingleElementReturn = new List<clssRules>();
Dictionary<string, double> dic_CandidatesReturn = new Dictionary<string, double>();
for (int i = 0; i < dic_FrequentItems.Count - 1; i++)
{
string strFirstItem = Alphabetize(dic_FrequentItems.Keys.ElementAt(i));
for (int j = i + 1; j < dic_FrequentItems.Count; j++)
{
string strSecondItem = Alphabetize(dic_FrequentItems.Keys.ElementAt(j));
string strGeneratedCandidate = GetCandidate(strFirstItem, strSecondItem);
string[] l = strGeneratedCandidate.Split(' '); //1,2 --> 1 and 2
GetSingleElement(l, dic_FrequentItemsL1, strGeneratedCandidate);
}
}
return dic_CandidatesReturn;
}
double sqq;
private Dictionary<string,string> GetSingleElement(string[] l, Dictionary<string, double> dic_FrequentItemsL1, string strGeneratedCandidate)
{
Dictionary<string, double> value = new Dictionary<string, double>();
Dictionary<string, string> dic_MaxReturn = new Dictionary<string, string>();
//string firstItem = l[0]; //12,13,14,15............foreach
// string[] q = l; // <-- here problem...
string qq = "";
string[] terms = new string[l.Length];
//int[] terms = new int[10];
foreach (string v in l)
{
string a = v.Replace("\r\n", " ");
foreach (var s in a)
{
qq = s.ToString();
MessageBox.Show(qq, "q");
//qq = match with dictionary(dic_FrequentItemsL1) single set...example if 1 the outcome is 5 , meanwhile if 2 its comes out with 3...
sqq = dic_FrequentItemsL1[qq];
MessageBox.Show(sqq.ToString());
for (int index = 0; index < l.Length; index++)
{
terms[index] = sqq.ToString(); // just to give it a unique value you can see
MessageBox.Show(terms[index], "terms[index]");
}
}
}
MessageBox.Show(terms[0].ToString(), "arrays[0]");
MessageBox.Show(terms[1].ToString(), "arrays[1]");
getMaxValue(terms);
dic_MaxReturn.Add(strGeneratedCandidate, getMaxValue(terms));
return dic_MaxReturn;
}
public static string getMaxValue(string[] numbers)
{
string maxValue = numbers[0];
MessageBox.Show(maxValue, "maxValue");
for (int i = 1; i < numbers.Length; i++)
{
if (numbers[i] > maxValue)
{
maxValue = numbers[i];
}
}
return maxValue;
}
are you guys clear right now, what i want to do???

New Topic/Question
Reply




MultiQuote



|