title: Removing non Printable values aftert Encoding.ASCII.GetString()
body: <p>Suppose I have a Byte array and I use <code>Encoding.ASCII.GetString()</code> to convert the bytes into a string. Now the first few bytes will contain actual values, but the remaining ones will all have value of <strong>0</strong>. After obtaining the string, when I show it on a WPF Form, there are some non printable characters. How can I remove these non printable characters. One way would be to loop through the array and only consider up to an index not containing <strong>0</strong>, but I may also Encode using Unicode, that is <code>Encoding.Unicode.GetString()</code>.</p>
  
  <p>What would be the most generic way to solve the problem.</p>