System.__Filters.FilterName C# (CSharp) Method

FilterName() private method

private FilterName ( MemberInfo m, Object filterCriteria ) : bool
m System.Reflection.MemberInfo
filterCriteria Object
return bool
        internal virtual bool FilterName(MemberInfo m,Object filterCriteria)
        {
            // Check that the criteria object is a String object
            if(filterCriteria == null || !(filterCriteria is String))
                throw new InvalidFilterCriteriaException(Environment.GetResourceString("RFLCT.FltCritString"));
    
            // At the moment this fails if its done on a single line....
            String str = ((String) filterCriteria);
            str = str.Trim();
    
            String name = m.Name;
            // Get the nested class name only, as opposed to the mangled one
            if (m.MemberType == MemberTypes.NestedType) 
                name = name.Substring(name.LastIndexOf('+') + 1);
            // Check to see if this is a prefix or exact match requirement
            if (str.Length > 0 && str[str.Length - 1] == '*') {
                str = str.Substring(0, str.Length - 1);
                return (name.StartsWith(str, StringComparison.Ordinal));
            }
    
            return (name.Equals(str));
        }