/// <summary> /// Checks whether the pattern approximately matches (~=) the source. /// Warning: locally, this does a lower-invariant .Match(). This may not line /// up with LDAP implementations. Take local, unit test results with a grain of salt. /// </summary> /// <param name="source">The source to match against.</param> /// <param name="pattern">The pattern to match (ex: some*thing).</param> /// <returns>True, if it matches.</returns> public static bool Approx <T, TConv>(this BaseLdapType <T, TConv> source, string pattern) where T : IComparable where TConv : class, IConverter <T> { if (source == null) { return(false); } if (pattern == "*") { return(true); // existence check operator } return(Matches(source, pattern)); }
/// <summary> /// Alias for .Matches("*"). /// </summary> /// <param name="source">The source data.</param> /// <returns>True, if it matches.</returns> public static bool Any <T, TConv>(this BaseLdapType <T, TConv> source) where T : IComparable where TConv : class, IConverter <T> => Matches(source, "*");