title: Check if name string contains first and last name
body: <p>I have a string that contains a first and last name and I wanted to split into two separate strings so I used this code: </p>
  
  <pre><code>string Delname = bkDel.ContactName;
  string[] Deltmp = Delname.Split(' ');
  string DelFirstName = Deltmp[0];
  string DelLastName = Deltmp[1];
  </code></pre>
  
  <p>It works fine if there is a first and last name but this causes an error if the name string only contains a first name:</p>
  
  <blockquote>
    <p>Index was outside the bounds of the array.</p>
  </blockquote>
  
  <p>since <code>Deltmp[1]</code> is null.</p>
  
  <p>Is there a way to check the name string so if it only contains one string then don't try and split?</p>