Creating a new Regex every ConsoleEx.Write is inefficient


const string colorMarkupRE = @"<(\w*):(\w*)>";
MatchCollection matches = Regex.Matches(resolvedText, colorMarkupRE);
Inside the method void ConsoleEx.Write(string text, params object[] args), the color markup regular expression is compiled into .NET's inner representation every time Write is called, which is rather inefficient.
private static Regex colorMarkup = new Regex(@"<(\w*):(\w*)>",RegexOptions.None);   would really help. You might even consider using RegexOptions.Compiled at the cost of increased start-up time.
Closed Jul 18, 2007 at 12:06 AM by jeevanjj
Thanks SealedSun, the issue has been fixed. The changes have been checked into the Subversion repository at SourceForge.