EvaluateOptions.IterateParameters, Custom Functions and strings

Topics: General, Help
Mar 16, 2012 at 7:40 PM

Correct me if I am wrong, but if you use EvaluateOptions.IterateParameters, then you cannot use e.EvaluateParameters, you have to set them prior to calling e.Evaluate().

I don't know if that would solve my problem or not, but something I noticed.

I have a need for a custom function that takes an IEnumerable parameter as an input.  I thought I could fake this out by converting my number array to a string, but in all my testing so far, no matter what I try to set the parameter value to, it sends each & every character or value to the EvaluateFunction delagate individually.

We always need to Evaluate with EvaluateOptions.IterateParameters, because that's 99% of what we want to do.  The forumlas are externally configured and our evaluations need to be totally generic, based soly on parameter & funciton names, so I can't sometimes use it and sometimes not.  Also, I want to do it both ways in the same formula.

here's a ver simple example of what we could have:

(MyFunc([a]) + [b]) / [c]

where [a] & [c] are IEnumerables of the same (but unknown) length.  [b] is a singular value.  In my case, MyFunc() is trying to find the Max value of the array (so I can't use the native Max(a,b) ).

MyFunc(1, 2, 3, 4, 5) - works. the 1, 2, 3, 4, 5 is sent in as a single iEnumerable length 5.

MyFunc(1, 2, 3, 4, 5) + [a] - also works

MyFunc([a]) - and setting [a] to the string "1, 2, 3, 4, 5" sends '1', then ',', then ' ', etc.  If I set it to "'1, 2, 3, 4, 5 '", then I get the same thing, but with a single quote first.

I get why if I try to send it an IEnumberable of numbers it sends each one individually to the EvaluateFunction delegate (that's what the option says to do), but I don't get the string.  Why is each character sent seperately as if it were an IEnumerable of char (which I guess it is, but would I really want to treat ti that way?) Is there a work around?