Get list of files in directory with exclude option
A few things I noticed:


If the exclude array is empty you return an empty list instead of every file.
reversing your logic would allow you to check everything in one statement.
Since you're returning an IEnumerable&lt;string&gt; already, using the yield operator would make sense here.
Accepting an IEnumerable&lt;string&gt; instead of an string[] for the exclude parameter, gives the user more options.  Also this allows you to leverage the LINQ extensions better.


Your code could look something like this:

public static IEnumerable&lt;string&gt; GetFiles(string path, IEnumerable&lt;string&gt; exclude, SearchOption searchOption = SearchOption.AllDirectories)
{
    IEnumerable&lt;FileInfo&gt; files = new DirectoryInfo(path).EnumerateFiles("*.*", searchOption);
    foreach (var filename in files)
    {

        if (!exclude.Any(x =&gt; x == filename.Name || (x.StartsWith("*") &amp;&amp; x.Contains(filename.Extension))))
        {
            yield return filename.Name;
        }

    }
}