HOW TO: Pass Optional Method Arguments from C#
-
Yeah but that shows how to use it from C#. Not how to implement it in C#. :( David Stone But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*. Shog9
-
Yeah but that shows how to use it from C#. Not how to implement it in C#. :( David Stone But Clinton wasn't a predictable, boring, aging, lying, eloquent, maintainer-of-the-status-quo. He was a predictable, boring-but-trying-to-look-hip, aging-and-fat-but-seemingly-oblivious-to-it, lying-but-in-sadly-blatant-ways, not-eloquent-but-trying-to-make-up-for-it-by-talking-even-more, bringer-in-of-scary-and-potentially-dangerous-new-policies. And there was also Al Gore. It just wasn't *right*. Shog9
thats because you cant. says so in the first paragraph. ;P
:suss: Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk
:suss:"All programmers are playwrights and all computers are lousy actors." -
thats because you cant. says so in the first paragraph. ;P
:suss: Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk
:suss:"All programmers are playwrights and all computers are lousy actors." -
Not quite true. C# supports the params keyword, which allows an object[] of user-defined size to be passed as a method parameter. This could be used to implement optional args in a sense. Bill F
i suppose, but not in the same manner as in c++ which i think is better.
:suss: Email: theeclypse@hotmail.com URL: http://www.onyeyiri.co.uk
:suss:"All programmers are playwrights and all computers are lousy actors." -
Not quite true. C# supports the params keyword, which allows an object[] of user-defined size to be passed as a method parameter. This could be used to implement optional args in a sense. Bill F
bfarley wrote: in a sense Those are the key words right there.... Instead of writing a normal method and specifying default values you have to go through the array and find out which parameters go where, and lord help you if you have two parameters of the same type but only one is in the array :wtf: There are times where I like not having optional parameters because it makes the user of that code think before just accepting the defaults; other times its a real PITA. James "And we are all men; apart from the females." - Colin Davies
-
bfarley wrote: in a sense Those are the key words right there.... Instead of writing a normal method and specifying default values you have to go through the array and find out which parameters go where, and lord help you if you have two parameters of the same type but only one is in the array :wtf: There are times where I like not having optional parameters because it makes the user of that code think before just accepting the defaults; other times its a real PITA. James "And we are all men; apart from the females." - Colin Davies