Reputation: 3101
I have following Code :
return regex.Replace(sourceData, (MatchEvaluator)(oMatch => ReplaceItem(oMatch, oObject)));
i am using .Net 2.0 and i am getting an error Invalid Expression term '>'
how to solve this error ?
Upvotes: 0
Views: 1062
Reputation: 239814
If you're not using a C# 3.0 (or later) compiler, then lambda expressions are not supported, and you'll have to use an anonymous method instead
return regex.Replace(sourceData, delegate(Match oMatch) { ReplaceItem(oMatch, oObject);});
(Not sure I've got it exactly right, I'm a little rusty)
Upvotes: 1
Reputation: 35255
C# 2.0 doesn't have support for lambdas, you need to convert oMatch => ReplaceItem(oMatch, oObject)
into MatchEvaluator delegate type function.
Upvotes: 0