title: Object reference not set to an instance of an object Error in List
body: <p>Return this error "Object reference not set to an instance of an object Error" when trying to add item in list. In the other words it's return error in  addtoNote.Add(Name); and am sure that Name is not null.</p>
  
  <pre><code>protected void features(string Name, string shortName)
  { List&lt;string&gt; addtoNote =  ViewState["Note"] as List&lt;string&gt; ;
      if (Name.Length &gt; 0)
      {
          addtoNote.Add(Name);
      } else
      {for (int x = 0; x &lt; addtoNote.Count; x++)
          {if (addtoNote[x].StartsWith(shortName))
              {
                  addtoNote.RemoveAt(x);}
          } }
      ViewState["Note"] = addtoNote;
      TxtNote.Text = string.Join(TxtNote.Text , ",", addtoNote);
  }
  protected void ChkPersonalAccedent_CheckedChanged(object sender, EventArgs e)
  {if (ChkPersonalAccedent.Checked == true)
      { features("حوادث شخصية", "حوادث شخصية");}
      else
       { features("", "حوادث شخصية"); }}
  </code></pre>