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

New Post: Optional arguments

$
0
0
OMG, this is so simple. Shame on me!

When writing this one:
public string Foo(
    string a,
    object argument0 = null,
    object argument1 = null)
{
    // ...
}
It runs like a charm!

I.e. simply using the standard C# way of declaring optional parameters is totally sufficient.

(Instead of "null" I also could have used "Missing.Value" to keep my inner logic the same as in my VBScript engine)

Viewing all articles
Browse latest Browse all 2297

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>