예제 #1
0
        /// <summary>
        /// Checks whether an LDAP filter pattern matches any member of the multi-valued source.
        /// </summary>
        /// <param name="source">The multi-valued source.</param>
        /// <param name="pattern">The LDAP filter pattern (ex: some*thing).</param>
        /// <returns>True, if it matches.</returns>
        public static bool Matches <T, U>(this BaseLdapManyType <T, U> source, string pattern)
            where T : IComparable
            where U : class, IConverter <List <T> >
        {
            if (source == null)
            {
                return(false);
            }

            if (pattern == "*")
            {
                return(true); // existence check operator
            }

            return(source.Any(e => Matches(e.ToString(), pattern)));
        }
예제 #2
0
 /// <summary>
 /// Alias for .Matches("*").
 /// </summary>
 /// <param name="source">The multi-valued source.</param>
 /// <returns>True, if it matches.</returns>
 public static bool Any <T, U>(this BaseLdapManyType <T, U> source)
     where T : IComparable
     where U : class, IConverter <List <T> >
 => Matches <T, U>(source, "*");