title: Are 64 nested If/Else statements bad?
body: <p>I've got a bit of a dilemma. I have to do some sorting of a list. There are 2 lists that users can select from and then select one of the elements in that list to sort on. Unfortunately for me, the second list is a child list, within the first list.</p>
  <p>The child list will require slightly different logic other than if the user just chose from the parent list. I have the logic down to sort on either the parent and/or the child list using LINQ so I'm not too worried about the logic of it.</p>
  <p>There is also the option to choose on ascending or descending order to make matter worse, at least for me. I've gone through the logic and it looks as though there will be a total of 64 if/else statements that I will need to use in order to incorporate all the scenarios.</p>
  <p>My first reaction was that this wasn't a very good way to go about it as this seems like a lot of if/else statements. Is there a better way to go about this or do I just need to bite the bullet:</p>
  <p>Logic for Parent:</p>
  <pre><code>Positions.Select(x =&gt; x.Product).OrderBy(x=&gt;x.Price).AsQueryable();
  </code></pre>
  <p>Logic for Child:</p>
  <pre><code>Positions.Select(x =&gt; x.Product).OrderBy(x=&gt;x.Performance.OrderBy(c=&gt;c.AssortmentCategory).Select(c=&gt;c.AssortmentCategory).FirstOrDefault()).AsQueryable();
  </code></pre>
  <p>Positions and Performance are both ListExtended's, if that matters. Also, I'm using the Dynamic LINQ library as I will be getting user input, though that is not shown above.</p>
  <p>Edit1: I forgot to say this sorts only the parent list. Even if they choose an element from the child list, it will sort the parent list.</p>