title: C# - Inserting Dictionary Keys/Values into New Tuple
body: <p>I've read some similar posts, but many are just asking about inserting dictionaries into tuples and vice versa.  My issue is that I have two separate dictionaries that I want to use to fill in a new tuple.</p>
  
  <p>The the two dictionaries have some common information, which is the user's email.  The <code>addressBook</code> dictionary holds the user's name and the user's email.  The <code>usersAndManagersList</code> holds the user's email and the manager's email.  I was hoping to match up the two then put all bits of information into a single tuple to easily pass around this instead of two dictionaries.</p>
  
  <pre><code>public static Tuple&lt;string, string, string&gt; allUserInformation(Dictionary&lt;string, string&gt; addressBook, Dictionary&lt;string, string&gt; usersAndManagersList)
      {
          Tuple&lt;string, string, string&gt; allUserInfo;
  
          foreach (var thing in addressBook)
          {
              foreach (var that in usersAndManagersList)
              {
                  if (thing.Value == that.Key)
                  {
                      var userName = thing.Key;
                      var userEmail = thing.Value;
                      var managerEmail = that.Value;
  
                      Console.WriteLine("User: {0}, User's Email: {1}, Manager's Email: {2}", userName, userEmail, managerEmail);
  
                      allUserInfo = Tuple.Create(userName, userEmail, managerEmail);
                  }
              }
          }
  
          return allUserInfo; 
      }
  </code></pre>
  
  <p>The values in the <code>addressBook</code> and the keys in the <code>usersAndManagersList</code> are both the users' emails.  I was trying to loop through everything and if the values of one match up with the keys of the other, then the user's email, user's name, and manager's email will be used to create a tuple, then starts over in the loop.</p>
  
  <p>Main struggles: I'm stuck if I should use a <code>while</code> or <code>if</code> loop.  I'm worried about scope and where exactly should I <code>return</code> the tuple.  An error I've gotten is that I'm returning an empty/unassigned tuple, which I understand why based on where I returned it, but I'm not sure how to fix it.  How do I create this tuple with the right loops, etc.?  Thank you in advance.</p>