[Mono-devel-list] Type.FilterName Fix

Willibald Krenn Willibald.Krenn at gmx.at
Tue Jan 18 21:28:27 EST 2005


Ben Maurer schrieb:
>>	/* last char can be '*' */
>>	if (name.EndsWith ("*"))
>>		filterLen--;
>>
>>	return String.Compare (name, 0, m.Name, 0, filterLen, false,
>>		 CultureInfo.InvariantCulture) == 0;
>>}
> 
> 
> String.Compare is going to be much slower than String.Equals, so you
> should use the .Equals for the default case.

Ok, no problem (actually the mixed type was my first version), but as I 
do not have svn (write) access, I can't commit it and so any change I 
make to this is more or less meaningless..

However, just as a quick hack:

int filterLen = name.Length;
if (name [filterLen] != "*")
	return name.Equals(m.Name);
else
	return String.Compare (name, 0, m.Name, 0, filterLen-1, false,
		CultureInfo.InvariantCulture) == 0;



Willi




More information about the Mono-devel-list mailing list