title: Using custom object as dictionary key but get values by object property
body: <p>I have a class:</p>
  
  <pre><code>public class Foo
  {
      public string Name { get; set; }
      public double Value { get; set; }
  
      public override string ToString()
      {
          return Name;
      }
  }
  </code></pre>
  
  <p>And I need to create a dictionary where key is object of Foo. Like this:</p>
  
  <pre><code>Foo foo1 = new Foo { Name = "Foo1", Value = 2.2 };
  Foo foo2 = new Foo { Name = "Foo2", Value = 3.6 };
  
  Dictionary&lt;Foo, int&gt; dic = new Dictionary&lt;Foo, int&gt;();
  dic.Add(foo1, 1234);
  dic.Add(foo2, 2345);
  </code></pre>
  
  <p>And now I want to get values from dictionary by passing Foo.Name property as key. Like this:</p>
  
  <pre><code>int i=dic["Foo1"];
  // i==1234
  i = dic["Foo2"];
  // i==2345
  </code></pre>
  
  <p>Is it possible? Or the only way to pass object of Foo as key and override Equals method?</p>