[runtime] Fix corlib out of date error with disabled COM
[mono.git] / mcs / class / referencesource / System.Activities.Presentation / System.Activities.Presentation / System / Activities / Presentation / Base / Core / PropertyEditing / PropertyFilterPredicate.cs
1 namespace System.Activities.Presentation.PropertyEditing {
2     using System;
3     using System.Globalization;
4     using System.Runtime;
5     using System.Activities.Presentation;
6
7     /// <summary>
8     /// Represents a predicate for search/filtering 
9     /// </summary>
10     [Fx.Tag.XamlVisible(false)]
11     public class PropertyFilterPredicate
12     {
13         private string _matchText;
14
15         /// <summary>
16         /// Creates a PropertyFilterPredicate.
17         /// </summary>
18         /// <param name="matchText"></param>
19         /// <exception cref="ArgumentNullException">When matchText is null</exception>
20         public PropertyFilterPredicate(string matchText) {
21             if (matchText == null)
22                 throw FxTrace.Exception.ArgumentNull("matchText");
23
24             _matchText = matchText.ToUpper(CultureInfo.CurrentCulture);
25         }
26
27         /// <summary>
28         /// Gets the string predicate
29         /// </summary>
30         protected string MatchText {
31             get {
32                 return _matchText;
33             }
34         }
35
36         /// <summary>
37         /// Returns true if a case insensitive match of the predicate string is contained
38         /// within the target string.
39         /// </summary>
40         /// <param name="target">The string filter</param>
41         /// <returns></returns>
42         public virtual bool Match(string target) {
43             return target != null && target.ToUpper(CultureInfo.CurrentCulture).Contains(_matchText);
44         }
45     }
46 }