title: c# Nested Dictionary, better alternative? best organize data across three classes
body: <p>Suppose</p>
  
  <p>There is a Trend class.</p>
  
  <pre><code>public class Trend{ 
      public string TrendName { get; set; }
      public string Description { get; set; }
  }
  </code></pre>
  
  <p>e.g.</p>
  
  <pre><code>new Trend() { TrendName= "Pizza", Description="yum yum" };
  new Trend() { TrendName= "Clothing", Description="ba yum" };
  new Trend() { TrendName= "Food" };
  </code></pre>
  
  <p>There is a Person class.</p>
  
  <pre><code>public class Person { 
      public string PersonName { get; }
      public int PersonId { get; }
      public int aptitude { get; }
      ...... many other properties
  }
  </code></pre>
  
  <p>e.g.</p>
  
  <pre><code>new Person() { PersonName = "Arnold Palmer" };
  new Person() { PersonName = "Ken Hemingway" };
  </code></pre>
  
  <p>There is a thing class.</p>
  
  <pre><code>public class TrendyItem
  {
      public string ItemName { get; }
      public string ItemId { get; }
  }
  </code></pre>
  
  <p>e.g.</p>
  
  <pre><code>new TrendyItem() { ItemName = "PotatoPizza" }
  new TrendyItem() { ItemName = "PeplumSkirt" }
  </code></pre>
  
  <p>There is a TrendysOfYear class. This class already has.</p>
  
  <pre><code>public class TrendProfile
  {
      public List&lt;Trend&gt; FavoriteTrendsOfYear;
      public List&lt;Person&gt; ActivePeopleThisYear;
      public List&lt;TrendyItem&gt; TrendyItemsThisYear;    
  }
  </code></pre>
  
  <p>For every TrendysOfYear,
  There will be a list of different trends, FavoriteTrendsOfYear, </p>
  
  <p>each person belonging to the ActivePeopleThisYear </p>
  
  <p>will specifiy a "TrendyItem" </p>
  
  <p>Given a TrendProfile, I want to be able to be able to quickly look up </p>
  
  <p>1) Input: Person; Output: List of Person's choice on trendy items.</p>
  
  <p>2) Input: Trend; Output: List of trendy items belonging to that trend.</p>
  
  <p>I've considered two ways. </p>
  
  <p>A) <code>Dictionary&lt;Person, Dictionary&lt;Trend, TrendyItem&gt;&gt;</code> </p>
  
  <p>You can get PersonsChoiceOnTrendyItem = dic[Person].Values.ToList();</p>
  
  <p>but have to loop through and build new list everytime you look up TrendyItemsOfTrend.</p>
  
  <p>B) <code>Dictionary&lt;Trend, Dictionary&lt;Person, TrendyItem&gt;&gt;</code></p>
  
  <p>vice cesra.</p>
  
  <p>Is it a good practice to use these custom objects for dictionary keys?</p>
  
  <p>Is it a good practice to use nested dictionaries?</p>
  
  <p>What's the best way to map items in this case?</p>
  
  <p>Also, not that Trend class does not have integer Id, so will have to used the string (the name of the trend is guaranteed to be unique) as key.</p>
  
  <hr>
  
  <p>Additional Info: properties of Trend such as TrendName and Description are editable. So i'm a little hesitant to add collection of TrendyItems to Trend class. If there is Trend, "Fashionn" in TrendProfile1 and TrendProfile2, and someone decides to change the name to "Fashion", I want both profiles to reference the same object. </p>