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

Joshua Kugler joshua.kugler at uaf.edu
Mon Feb 13 15:20:53 EST 2006


On Monday 13 February 2006 11:12, Alex Chudnovsky wrote:
> 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;
> }

Or at least declare it static in the sub (I assume you can do that)?

static bool CheckString (string val)
{
	static Regex regex = new Regex("<[a-zA-Z\\!]+");
	Match match = regex.Match(val);
 	return match.Success;
}


-- 
Joshua Kugler                 PGP Key: http://pgp.mit.edu/
CDE System Administrator             ID 0xDB26D7CE
http://distance.uaf.edu/



More information about the Mono-devel-list mailing list