title: How do i acces individual Values in a hash table
body: <p>I have an assignment where i have to take an string input and apply zipfs law to it. Im having issues accessing the value in a hashtable. Whenever i find a word that already exist i'm supposed to update the wordcounter +1. What ends up happening is the counter applies to all the values in the hash table, and i get ridiculously high numbers. I cant wrap my head around how i'm supposed to give an individual counter for each keyvalue</p>
  
  <p>Here is the code:</p>
  
  <pre><code>using System;
  using Spire.Doc;
  using System.Collections;
  using System.Collections.Generic;
  
  namespace Zipf
  {
      class Program
      {
          public static Hashtable wordRegister;
  
  
          static void Main(string[] args)
          {
              String[] ArrLoop = TextSplitter();
              int[] wordCount = new int[ArrLoop.Length];
              int count = 1;
              wordRegister = new Hashtable();
  
  
              for(int i = 0; i &lt; ArrLoop.Length; i++)
              {
                  if (wordRegister.ContainsKey(ArrLoop[i]))
                  {
                      // here is where im having trouble
                      wordRegister[ArrLoop[i]] = count += 1;
  
                  }
                  else
                  {
                      wordRegister.Add(ArrLoop[i], count);
                  }
  
  
  
              }
              foreach (DictionaryEntry pair in wordRegister)
              {
                  Console.WriteLine($"Key : {pair.Key} ; Forekomster : {pair.Value}");
              }
              Console.ReadLine();
  
  
          }
  
          public static String WordString()
          {
              Document doc = new Document();
              doc.LoadFromFile(@"C:\Users\xxx\Desktop\2.g\IDO.docx");
  
              String textString = doc.GetText();
  
              return textString;
  
           }
  
          public static string[] TextSplitter()
          {
              string s = WordString();
              String[] wordArr = s.Split();
  
              return wordArr;
          }
  
  
  
  
  }
  </code></pre>
  
  <p>}</p>