Free Support Forum - aspose.com

Custom Definition .. How to Verify

What's my best course of action to verify (a string) as a legitimate Custom Expression?

For example: (using your example)

string testIt = "DTSTART:20040930T090000
RRULE:FREQ=MONTHLY;COUNT=10;BYMONTHDAY=1,-1";

bool b = SomeICalendarObject.Verify(testIt);

testIt = "garblyGooBadStuffHere";

bool b = SomeICalendarObject.Verify(testIt);

Something along those lines.

The demo code seems to just throw it out, if it fails.

I also pulled this value from the forums:

And it fails for me:

string testIt = "DTSTART:20040105T000000
RRULE:FREQ=MONTHLY;INTERVAL=6;BYDAY=1MO,2MO,3MO'";

bool b = SomeICalendarObject.Verify(testIt);

At the moment there is no separate function to validate a pattern. You have to wrap the call into a trh/catch block, if you get an exception the pattern is invalid. It is not nice, but no other way at the moment.