How to count the frequency of bundle of number, {1},{1,2},{2,3,4} using c#?
<p>someone can help me??
i have done this coding. but have error.. do not know what the problem are? 
this coding try to:</p>

<ol>
<li>read data from text file (bundle of number)</li>
<li>then, count the frequency of 1-itemset, </li>
<li>from that, produce the possible combination itemset, 2-itemset, 3-itemset and others.</li>
<li>the frequency of possible combination itemset also counted. </li>
</ol>

<p>1,2,3,4,2,1,3,1,3 -> {1} - 3, {2} - 2, {3} - 3, {4} - 1 -> {1,2}-2,{1,3}-1,{2,3}-2</p>

<pre><code>size = -1;
string originalData = "";
string text1 = File.ReadAllText(file);
//textBox2.Text = text;
size = text1.Length;
string horizontal;

    horizontal = text1.Replace("\r\n", " ");
    originalData += horizontal;
    string[] items = (originalData).Split(' ');
    SortedList itemlist = new SortedList();
    HashSet&lt;string&gt; hFrequentItems = new HashSet&lt;string&gt;();
    SortedList patternList = new SortedList();

    foreach (string item in items)
    {
        if (!(itemlist.ContainsKey(item)))
        {
            itemlist.Add(item, 1);
        }
        else
        {
            int itemCount = (int)itemlist[item];
            itemlist[item] = itemCount + 1; 
        }
    }

    int intMinSupp=2;
    //SortedList hFrequentItems = new SortedList();
    IDictionaryEnumerator enumerator = itemlist.GetEnumerator();

    while (enumerator.MoveNext())
    {
        if ((int)(enumerator.Value) &gt;= intMinSupp)
        {
            //MessageBox.Show((string)enumerator.Current);
            hFrequentItems.Add((enumerator.Key.ToString().Trim()));
        }
    }

    string line;
    string item_pattern = " ";
    StreamReader file1 = new StreamReader(file);
    while((line = file1.ReadLine())!=null)

        item_pattern = " ";

        HashSet&lt;string&gt; _hLineItems = new HashSet&lt;string&gt;((line).Split(' ')); //convert string to hashset 

        _hLineItems.UnionWith(hFrequentItems);
        _hLineItems.IntersectWith(_hLineItems);

        int itr = 0;
        foreach(string item in _hLineItems)
        {
            itr++;
            item_pattern = (item_pattern + " " + item).Trim();
            //MessageBox.Show(item_pattern.ToString());
            if(itr &gt;1)
            {
                if(!(patternList.ContainsKey(item_pattern)))
                {
                    patternList.Add(item_pattern,1);
                }
                else
                {

                    int iPatternCount = (int)patternList[item_pattern];
                    patternList[item_pattern] = iPatternCount + 1;

                }
            }
        }
        itr = 0;
        _hLineItems.Clear();

    }
</code></pre>
