title: ToList() taking to long when converting an IEnumerable with multiple objects
body: <p>I have the following classes:</p>
  
  <pre><code>public class CountryVM
      {
          #region Properties
          public int CountryID { get; set; }
          public string Code { get; set; }
          public string Name { get; set; }
          #endregion
  
          #region Constructors
          /// &lt;summary&gt;
          /// Constructor
          /// &lt;/summary&gt;
          public CountryVM()
          {
  
          }
  
          /// &lt;summary&gt;
          /// Constructor that creates a View Model based of an Entity object
          /// &lt;/summary&gt;
          /// &lt;param name="countryCode"&gt;Fills data to View Model&lt;/param&gt;
          public CountryVM(Country_Code countryCode)
          {
              if (countryCode != null)
              {
                  CountryID = countryCode.Country_Code_ID;
                  Code = countryCode.Country_Code1;
                  Name = countryCode.Country_Name;
              }
          }
          #endregion
      }
  
  
  public class StateVM
      {
          #region Properties
          public int StateID { get; set; }
          public int CountryID { get; set; }
          public string Code { get; set; }
          public string Name { get; set; }
  
          public CountryVM Country { get; set; }
          #endregion
  
          #region Constructors
          /// &lt;summary&gt;
          /// Constructor
          /// &lt;/summary&gt;
          public StateVM()
          {
  
          }
  
          /// &lt;summary&gt;
          /// Constructor that creates a View Model based of an Entity object
          /// &lt;/summary&gt;
          /// &lt;param name="stateCode"&gt;Fills data to View Model&lt;/param&gt;
          public StateVM(State_Code stateCode)
          {
              if (stateCode != null)
              {
                  StateID = stateCode.State_Code_ID;
                  CountryID = stateCode.Country_Code_ID;
                  Code = stateCode.State_Code1;
                  Name = stateCode.State_Name;
  
                  Country = new CountryVM(stateCode.Country_Code);
              }
          }
          #endregion
      }
  </code></pre>
  
  <p>Both Country_Code and State_Code are tables from my tables converted to Entity objects.</p>
  
  <p>I run the following lines of code:</p>
  
  <pre><code>    IEnumerable&lt;State_Code&gt; entityList = _stateRepository.GetAllStateCodes();
      IEnumerable&lt;StateVM&gt; viewModelList = entityList.Select(s =&gt; new StateVM(s));
      viewModelList = viewModelList.ToList();
  </code></pre>
  
  <p>When running </p>
  
  <pre><code>viewModelList = viewModelList.ToList(); 
  </code></pre>
  
  <p>it takes between 1 to 3 seconds. I was experimenting with it and I removed the:</p>
  
  <pre><code>Country = new CountryVM(stateCode.Country_Code);
  </code></pre>
  
  <p>from the StateVM object, and it would run flawlessly.</p>
  
  <p>So, I guess the reason it takes too long it's because once StateVM is instantiated, a CountryVM will be instantiated inside.</p>
  
  <p>Is there way that I can improve the performance?</p>