Is there a syntax to use System.Text.RegularExpressions.Matc

Posted by dlauzon on 07-May-2010 13:43

Is there a syntax to use System.Text.RegularExpressions.MatchEvaluator?

At first try, I'd say that this is not feasible even under 10.2B with class Events delegates, but I just want to be sure.

Sample VB code to instanciate the class is:

Dim myEvaluator As MatchEvaluator = New MatchEvaluator(AddressOf ReplaceCC)

where ReplaceCC is an internal method of the current class defined as:

Public Function ReplaceCC(ByVal m As Match) As String

All Replies

Posted by whenshaw on 07-May-2010 14:01

David,

You're correct -- there is no way to instantiate a delegate in ABL, even though you can use a delegate type to define an event.

--Wayne

Posted by Peter Judge on 07-May-2010 14:06

You're correct -- there is no way to instantiate a delegate in ABL,

even though you can use a delegate type to define an event.

But with the caveat that the delegate have a void return type (the MatchEvaluator returns string, so I'm not sure how one'd go about that).

-- peter

Posted by whenshaw on 07-May-2010 14:41

Peter's caveat is, of course, correct. Delegates that you use to define ABL class events have to conform to the .NET convention for event handlers -- void return and two parameters, where the first parameter is a System.Object and the second is System.EventArgs or a type derived from System.EventArgs. Both MatchEvaluator's return type and its parameter list disqualify it from being used to define an ABL class event.

This thread is closed