To deploy Mrchief and Jurst's solution:
private string[] extensions = { ".css", ".less", ".cshtml", ".js" }; private void WatcherOnChanged(object sender, FileSystemEventArgs fileSystemEventArgs) { var ext = (Path.GetExtension(fileSystemEventArgs.FullPath) ?? string.Empty).ToLower(); if (extensions.Any(ext.Equals)) {
This removes the regular expression checker (which, in my opinion, is too much overhead), and uses Linq to our advantage. :)
Edited - A null error has been added to avoid a possible NullReferenceException.
Joe The Coder Jun 03 '13 at 15:23 2013-06-03 15:23
source share