title: LINQ method with varying parameters
body: <p>I have a LINQ method for the Search page of an in house app.  The method looks as below</p>
  
  <pre><code>    public static DataTable SearchForPerson(String FirstName, String MiddleName, String LastName, String SSN, DateTime? BirthDate)
      {
          var persons = (from person in context.tblPersons 
                         where person.LastName == LastName || person.LastName.StartsWith(LastName)
                         join addresse in context.tblAddresses on person.PersonID equals addresse.PersonID 
                         orderby person.LastName
                         select new { person.PersonID, person.LastName, person.FirstName, person.SSN, addresse.AddressLine1 });
  
          var filteredPersonsList = persons.Where(p =&gt; p.LastName == LastName).ToList();
          if (filteredPersonsList.Count == 0)
              filteredPersonsList = persons.Where(p =&gt; p.LastName.StartsWith(LastName)).ToList();
  
          var dataTable = filteredPersonsList.CopyLinqToDataTable();
  
  
  
          return dataTable;
      }
  </code></pre>
  
  <p>Now, as you can no doubt see, I made a <strong>slight</strong> oversight when creating this as it only searches by <code>LastName</code>.  I was in process of expanding this when it occured to me that I may not be going about this properly.  </p>
  
  <p>So, finally to my question; Is it more desirable(<em>read-best practice, more efficient, etc...</em>) to have a single method like this with a mechanism(<em>I am thinking a SWITCH on non-empty param</em>) to tell which parameter to search with or should I simply make multiple versions, a la <code>SearchForPersonByLastName</code> &amp; <code>SearchForPersonBySSN</code>?</p>
  
  <p>Additionally, is there an even more elagent solution to this, I would think common, issue?</p>