Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Optional parameter declaration in C3 3.5

Optional parameter declaration in C3 3.5

Scheduled Pinned Locked Moved C#
csharpquestion
9 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    abcurl
    wrote on last edited by
    #1

    Is there any way to do optional variable declaration in c# 3.5. I have two alternatives. (a) Function Overloading (b) declaring the function arguments in Params Object[] variable Can i do it exactly the way we can do in vb.net ?

    N 1 Reply Last reply
    0
    • A abcurl

      Is there any way to do optional variable declaration in c# 3.5. I have two alternatives. (a) Function Overloading (b) declaring the function arguments in Params Object[] variable Can i do it exactly the way we can do in vb.net ?

      N Offline
      N Offline
      Not Active
      wrote on last edited by
      #2

      C# 4.0 introduces optional parameters, you can't do it in 3.5.

      abcurl wrote:

      Can i do it exactly the way we can do in vb.net ?

      Why would you ever compare anything to VB? X| ;P


      I know the language. I've read a book. - _Madmatt

      K K A 3 Replies Last reply
      0
      • N Not Active

        C# 4.0 introduces optional parameters, you can't do it in 3.5.

        abcurl wrote:

        Can i do it exactly the way we can do in vb.net ?

        Why would you ever compare anything to VB? X| ;P


        I know the language. I've read a book. - _Madmatt

        K Offline
        K Offline
        Kevin McFarlane
        wrote on last edited by
        #3

        Mark Nischalke wrote:

        Why would you ever compare anything to VB?

        OK, well you can do optional parameters in C++. Would that have been a better comparison? ;P

        Kevin

        N K 2 Replies Last reply
        0
        • K Kevin McFarlane

          Mark Nischalke wrote:

          Why would you ever compare anything to VB?

          OK, well you can do optional parameters in C++. Would that have been a better comparison? ;P

          Kevin

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          Yes, VB and C++ are much closer. :laugh:


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • N Not Active

            C# 4.0 introduces optional parameters, you can't do it in 3.5.

            abcurl wrote:

            Can i do it exactly the way we can do in vb.net ?

            Why would you ever compare anything to VB? X| ;P


            I know the language. I've read a book. - _Madmatt

            K Offline
            K Offline
            Keith Barrow
            wrote on last edited by
            #5

            Here is how to do it in 4.0: Named and Optional Arguments[^] Told you: shameless :-)

            Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.

            1 Reply Last reply
            0
            • K Kevin McFarlane

              Mark Nischalke wrote:

              Why would you ever compare anything to VB?

              OK, well you can do optional parameters in C++. Would that have been a better comparison? ;P

              Kevin

              K Offline
              K Offline
              Keith Barrow
              wrote on last edited by
              #6

              VB can compared to many things, normally prefixed with "A big steaming pile of....." :-)

              Dalek Dave: There are many words that some find offensive, Homosexuality, Alcoholism, Religion, Visual Basic, Manchester United, Butter.

              1 Reply Last reply
              0
              • N Not Active

                C# 4.0 introduces optional parameters, you can't do it in 3.5.

                abcurl wrote:

                Can i do it exactly the way we can do in vb.net ?

                Why would you ever compare anything to VB? X| ;P


                I know the language. I've read a book. - _Madmatt

                A Offline
                A Offline
                Abhinav S
                wrote on last edited by
                #7

                Mark Nischalke wrote:

                C# 4.0 introduces optional parameters, you can't do it in 3.5.

                Back to the future......

                Me, I'm dishonest. And a dishonest man you can always trust to be dishonest.
                Honestly. It's the honest ones you want to watch out for...

                N 1 Reply Last reply
                0
                • A Abhinav S

                  Mark Nischalke wrote:

                  C# 4.0 introduces optional parameters, you can't do it in 3.5.

                  Back to the future......

                  Me, I'm dishonest. And a dishonest man you can always trust to be dishonest.
                  Honestly. It's the honest ones you want to watch out for...

                  N Offline
                  N Offline
                  Not Active
                  wrote on last edited by
                  #8

                  I'm polishing up the Delorean now ;P


                  I know the language. I've read a book. - _Madmatt

                  L 1 Reply Last reply
                  0
                  • N Not Active

                    I'm polishing up the Delorean now ;P


                    I know the language. I've read a book. - _Madmatt

                    L Offline
                    L Offline
                    Luc Pattyn
                    wrote on last edited by
                    #9

                    I never understood why it gathers that much dust while going back in time; most objects do when aging. :)

                    Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]


                    I only read code that is properly formatted, adding PRE tags is the easiest way to obtain that.


                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups