title: MVVM - Object ref not set to an instance
body: <p>I am trying to change a WPF I created (without using MVVM and DataBinding) into a WPF that does use those magnificient features.</p>
  
  <p>I have set up a Person Model with multiple properties (too lengthy to list here) with all of the gets and sets and even the NotifyProtertyChanged attribute such as the ID and Full Name attributes.</p>
  
  <p>Now I want to (launching the code with the click of a button to ensure I know when it starts for now while I am writing the code) have my WPF application go through a list of values, compare it to an online XML Document and retrieve a list of data from it for each person in the list matching the value looked for and of course set some of the model's properties.</p>
  
  <p>An example:
  - Looking for "Lewitt"
  - The XML Document has 4 people with the Last name Lewitt so it adds those 4 people to my list (comprising items set as the Person model class i have set up before) and setting the values for each item's ID and FullName (shortened for the example).</p>
  
  <p>This is my informationProvider Class that I implemented so far when search for a certain value (called searchstring):</p>
  
  <pre><code>    public List&lt;Person&gt; GetPeople(string searchstring)
      {
          string url = string.Format("{0}{1}", BaseURL, HttpUtility.HtmlEncode(searchstring));
          XDocument doc = XDocument.Load(url);
  
          var names = (from s in doc.Root.Elements("Persons").Where(s =&gt; s.Element("Lastname").Value.Equals(searchstring, StringComparison.InvariantCultureIgnoreCase))
                       select new Person
                       {
                           ID = Convert.ToInt32(s.Element("id").Value),
                           fullName = s.Element("Firstname").Value + " " + s.Element("Lastname").Value
                       }).OrderBy(n =&gt; n.fullName).ToList();
          return people;
      }
  </code></pre>
  
  <p>I try to launch this process for my list of items as such through my button click (again, only for testing purposes) - I have set an example value of "Jane Doe" which does exist in teh XML Document we are looking in in the InformationProvider class:</p>
  
  <pre><code>            List&lt;Person&gt; persons= new List&lt;Person&gt;();
              persons= informationProvider.GetPeople(searchShowName);
  </code></pre>
  
  <p>My issue is that when I launch the code and click on teh button for testing, it throws an error stating "Object reference not set to an instance of an object." and highlights my line </p>
  
  <pre><code>        persons= informationProvider.GetPeople(searchShowName);
  </code></pre>
  
  <p>how can I fix this?</p>