title: C# condition check using try catch
body: <p>I have an array of files names.If no file is in the array i need to throw an exception.Can i use try catch .Any one knows please help.Thanks in advance.</p>
  
  <pre><code>  string[] fileEntries = Directory.GetFiles(filepath, "*.csv");.
  // throw an exception if no files
    if (fileEntries.Length == 0){}
  </code></pre>