class Dictionary

Discussion in 'C#' started by madsiro, Apr 20, 2008.

  1. madsiro

    madsiro New Member

    Joined:
    Apr 20, 2008
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hi, I'm programming in C #, and I have a question about the class dictionary, I know that this work as a hash table, but I would like to know how that hash function uses (or which is the one that could use), and that size is its table, here is an example of Dictionary, and here is my question.
    Code:
    private static Dictionary<string, double> PrepareFrequency(string[] words)
    {
        Dictionary<string, double> table = new Dictionary<string, double>();
    
        foreach (string word in words)
        {
            if (table.ContainsKey(word))
                table[word]++;
            else
                table.Add(word, 1);
        }
    
        return table;
    } 
    Thanks for your attention.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice