Default arg values

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • fragget

    Default arg values

    why doesnt c# support default arg values?
  • bwahahahaha

    #2
    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]


    Comment

    • Roberto Martinez-Brunet

      #3
      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 \)

        #4
        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

          #5
          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

          Working...