title: check if string contains any of the elements of a stringarray (vb net)
body: <p>I´ve got a little problem. At the end of a programm it should delete a folder.</p>
  
  <p>In ordern to deny deletion of a folder, which directory contains a certain word, I wanted to check if a string (the directory.fullname.tostring) contains any of the elements which are stored in a string array.
  The string array contains strings stating the exception words.</p>
  
  <p>This is how far I got and I know that the solution is the other way round than stated here:</p>
  
  <pre><code>If Not stackarray.Contains(dir.FullName.ToString) Then
  
                  Try
                      dir.Delete()
                      sw.WriteLine("deleting directory " + dir.FullName, True)
                      deldir = deldir + 1
                  Catch e As Exception
                      'write to log
                      sw.WriteLine("cannot delete directory " + dir.ToString + "because there are still files in there", True)
                      numbererror = numbererror + 1
                  End Try
              Else
                  sw.WriteLine("cannot delete directory " + dir.ToString + "because it is one of the exception directories", True)
              End If
  </code></pre>