FileMask RestrictionLambda Property CleanCode C# Libraries v1.2.03 API
Gets or sets a lambda function that may be used to further restrict the set of matched files.

Namespace: CleanCode.GeneralComponents.Controls
Assembly: CleanCode.GeneralComponents (in CleanCode.GeneralComponents.dll) Version: (1.2.03)

public FileMask..::..RestrictionLambdaDelegate RestrictionLambda { get; set; }

Field Value

The restriction lambda.

This callback function lets you add constraints beyond just matching file names as you can do with wildcards. You could, for example, restrict any files matched by the Mask value to also be after a certain date by specifying a lambda function like this:
fileMask.RestrictionLambda =
    f => DateTime.Compare(File.GetLastWriteTime(f), MyEarliestDateAllowed) >= 0;
You may use arbitrarily complex expressions but, ultimately, your function must return a Boolean value indicating whether the file should be included or not. Thus, in the example given, the possible OnlineCompare(DateTime, DateTime) return values of (-1, 0, or 1) are mapped to (true, false) with the inequality shown.
See Also