Hi at all,
Is possible to pass a parameter though a delegate or to override it? (I'm
newbie and I'm trying to understand delegates and their use in a real
scenario)
In my scenario I need to override
System.Text.Reg ularExpression. MatchEvaluator delegate passing it another
parameter.
For a concrete sample I paste some lines of code :
//my regexpression pattern;
Regex regexer= new Regex("myBeatif ulPattern", RegexOptions.Mu ltiline);
//Class MatchEvaluator can be created with a delegate to a custom replacing
function
MatchEvaluator myEvaluator = new MatchEvaluator( CommentMatchHan dler);
//this replace the occurrences based on regexer patterns
string result = regexer.Replace (code, myEvaluator);
public string MatchHandler(Ma tch match)
{
//DO SOMETHING on MYVALUE
return MYVALUE
}
Well,
in the above sample I'd like to have "MatchHandl er" function like :
public string MatchHandler(Ma tch match, string MYPARAMETER)
but is possible? :)
If I declare the function with the new parameter the code wouldn't compile
(and it's in right... it cannot take parameters in new
MatchEvaluator( CommentMatchHan dler);
Thanks,
Bob