title: Adding a null in a List<T> index: C#
body: <p>I have a small issue with providing user feedback.</p>
  
  <p>My solution is caked up into many layers (repositories, services, etc.). I would like to be able to propagate up to the top-most layer with valuable information should there be an issue with pulling data in any of the layers.</p>
  
  <p>I have to loop through an IEnumerable of database objects and map each (using AutoMapper) into POCO objects. In case there is an issue/exception with mapping a certain object, I want to note this and not affect the whole list. So I thought it would be best to catch the exception and add a null (or only set a single relevant property) in place of that object that caused the issue. That way we can do a check on another layer and know that there was an issue with some items.</p>
  
  <p>Is this considered good practice? Am I violating any fundamental programming principle?</p>
  
  <pre><code>foreach (var tranch in tranches)
  {
      try
      {
          //add option tranch to list
          tranchList.Add(Extensions.Map&lt;Tranch, TranchVm&gt;(tranch));
      }
      catch(Exception)
      {
          //if there is an issue with mapping an item, add the name of it and leave all other fields null
          response.Status = "warning";
          tranchList.Add(new TranchVm() { Description = tranch.Description });
      }
  }
  //check if the current status is not a warning, then set to success if not
  if (!response.Status.Equals("warning"))
  {
      response.Status = "success";
  }
  
  response.Data = tranchList;
  </code></pre>