why doesnt c# support default arg values?
Default arg values
Collapse
This topic is closed.
X
X
-
fraggetTags: None
-
bwahahahaha
Re: Default arg values
You mean like
someFN(int blah = 0, bool someFlag = true)
{
}
?
"fragget" <anonymous@disc ussions.microso ft.com> wrote in message
news:02fb01c394 14$5397f430$a30 1280a@phx.gbl.. .[color=blue]
> why doesnt c# support default arg values?[/color]
-
Roberto Martinez-Brunet
Re: Default arg values
Probably because overloading makes them unnecessary....
R
"fragget" <anonymous@disc ussions.microso ft.com> wrote in message
news:02fb01c394 14$5397f430$a30 1280a@phx.gbl.. .[color=blue]
> why doesnt c# support default arg values?[/color]
Comment
-
Ignacio Machin \( .NET/ C# MVP \)
Re: Default arg values
Hi,
There is no need, you can use overload for the same purpouse and therefore
the compiler is simpler.
void T()
{
T( defaultvalue);
}
void T( ParamType param)
{
//...
}
Cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"fragget" <anonymous@disc ussions.microso ft.com> wrote in message
news:02fb01c394 14$5397f430$a30 1280a@phx.gbl.. .[color=blue]
> why doesnt c# support default arg values?[/color]
Comment
-
Rick
Re: Default arg values
On Thu, 16 Oct 2003 16:54:31 -0400, Ignacio Machin wrote:[color=blue]
>
> "fragget" wrote...[color=green]
> >
> > why doesnt c# support default arg values?[/color]
>
> There is no need, you can use overload for the same purpouse and therefore
> the compiler is simpler.[/color]
True, but VB.NET supports overloads, and yet also supports optional
parameters.
I have yet to check whether the old C++ "gotcha" applies to virtual
methods, too, where you have to override all of the overloads if you
override one, otherwise the others become "hidden".
--
Rick
Reply to dev@ to avoid the spam trap
Comment
Comment