title: Count words and spaces in string C#
body: <p>I want to count words and spaces in my string. String looks like this:</p>
  
  <pre><code>Command do something ptuf(123) and bo(1).ctq[5] v:0,
  </code></pre>
  
  <p>I have something like this so far</p>
  
  <pre><code>int count = 0;
  string mystring = "Command do something ptuf(123) and bo(1).ctq[5] v:0,";
  foreach(char c in mystring) 
  {
  if(char.IsLetter(c)) 
    {
       count++;
    }
  }
  </code></pre>
  
  <p>What should I do to count spaces also?</p>