Quantcast
Channel: ClearScript
Viewing all articles
Browse latest Browse all 2297

New Post: Optional arguments

0
0
Currently I'm in the process of migrating my own VBScript ScriptingHost integration to ClearScript.

In my implementation the following script-exposed C# code run successfully:
public string Foo(
    string a,
    [Optional]object argument0,
    [Optional]object argument1)
{
    // ...
}
This could be called from VBScript with either one, two or three parameters. The reason is the "Optional" attribute which are attached to the second and third parameter.

When using it with ClearScript and the VBScript engine, the calling of the method results in and 0x80020101 error.

My questions:

Is it possible to use optional parameters with ClearScript? If yes, how would I do it?

Viewing all articles
Browse latest Browse all 2297