[Mono-dev] MS/Mono incompatibility in System.Web.HttpRequest

Alex Chudnovsky alexc at majestic12.co.uk
Mon Feb 13 15:12:20 EST 2006


Edward C. Eisenbrey wrote:

>using System.Text.RegularExpressions;
>
>static bool CheckString (string val)
>{
>	Regex regex = new Regex("<[a-zA-Z\\!]+");
>	Match match = regex.Match(val);
>	return match.Success;
>}
>
Pardon my instrusion, but would it not be better performance wise to 
create static instance of the regexp to avoid doing it every time 
CheckString called? Ie:

static Regex regex = new Regex("<[a-zA-Z\\!]+");

static bool CheckString (string val)
{

	Match match = regex.Match(val);
	return match.Success;
}


This is by no means not an attempt to dig at patch!

cheers

Alex





More information about the Mono-devel-list mailing list