title: Which consumes less space, UInt64 or a string in C#
body: <p>What will be the best idea in the context of C#,</p>
  
  <ol>
  <li><p>In C# i am using a dictionary. I want it to use less memory space. what will be better?</p>
  
  <p>A dictionary where the key type is <code>Uint64</code> or where the key type is a <code>string</code>? in both cases the value is a custom class which is same for each dictionary.</p>
  
  <p>I have declared the dictionary as following,</p>
  
  <pre><code>private static readonly Dictionary&lt;string, List&lt;Node&gt;&gt; HashTable =
      new Dictionary&lt;string, List&lt;Node&gt;&gt;();
  </code></pre>
  
  <p>class node is defined as below,</p>
  
  <pre><code>public class Node
  {
      public UInt64 CurrentIndex { get; set; }
      public string NextHashedString { get; set; }
      public int NextHashPos { get; set; }
  }
  </code></pre>
  
  <p>The key of the string is actually is a hashvalue from a string computed as follows,
  The length of string may be 1 to 20 characters.</p>
  
  <pre><code>static UInt64 CalculateHash(string read, bool lowTolerance)
  {
      UInt64 hashedValue = 0;
      int i = 0;
      while (i &lt; read.Length)
      {
          hashedValue += read.ElementAt(i) * (UInt64)Math.Pow(31, i);
          if (lowTolerance) i += 2;
          else i++;
      }
      return hashedValue;
  }
  </code></pre>
  
  <p>Now, I want to store this hash value as a key to the dictionary. What will be the best idea. I use as Uint64 or I convert it to string and use string as a dictionary key.
  My primary goal is the dictionary uses minimum space and search time for a key is faster.</p></li>
  <li><p>I have a file with 3571079 characters. Can I read the whole file into a string or I need advanced data structures?</p></li>
  </ol>