title: Grouping text by characters into dictionary of chacartes with Unicode code points in Hex format
body: <p>I'm trying to group a text by characters into dictionary and returning the Unicode code point of each character. I'm using the following code </p>
  
  <pre><code>private Dictionary&lt; Char, int&gt; GetChars(string input)
      {
  
          return input.GroupBy(ch =&gt; ch)
                      .ToDictionary(g =&gt; g.Key, g =&gt; (int) g.Key);
      } 
  </code></pre>
  
  <p>This code returns the Unicode code points of the characters in decimal format, but i want it in Hex format. Any help please ? </p>
  
  <p>Edit:</p>
  
  <p>Example: Input A 
           Output 65</p>
  
  <p>Shouldn't be 41 ?</p>
  
  <p>the right solution </p>
  
  <pre><code> private Dictionary&lt; Char, string&gt; GetChars(string input)
      {
  
          return input.GroupBy(ch =&gt; ch)
                      .ToDictionary(g =&gt; g.Key, g =&gt; ((int) g.Key).ToString("x"));
      } 
  </code></pre>