// FilterName // This method will filter based upon the name. A partial wildcard // at the end of the string is supported. // filterCriteria -- This is the string name private static bool FilterNameImpl(MemberInfo m, object filterCriteria, StringComparison comparison) { // Check that the criteria object is a String object if (!(filterCriteria is string filterCriteriaString)) { throw new InvalidFilterCriteriaException(SR.InvalidFilterCriteriaException_CritString); } ReadOnlySpan <char> str = filterCriteriaString.AsSpan().Trim(); ReadOnlySpan <char> name = m.Name; // Get the nested class name only, as opposed to the mangled one if (m.MemberType == MemberTypes.NestedType) { name = name.Slice(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.Slice(0, str.Length - 1); return(name.StartsWith(str, comparison)); } return(name.Equals(str, comparison)); }