Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 630987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T19:54:56+00:00 2026-05-13T19:54:56+00:00

I long for those sweet optional arguments from the days when I programmed in

  • 0

I long for those sweet optional arguments from the days when I programmed in C++ more. I know they don’t exist in C#, but my question is Why.

I think method overloading is a poor substitute which makes things messy very quickly.

void foo(int x,int y,int z=0){
  //do stuff...
}

//is so much more clean than

void foo(int x,int y){
  foo(x,y,0);
}
void foo(int x,int y,int z){
 //do stuff
}

I just do not understand what the reasoning is. The C# compiler would obviously not have a problem supporting this just Microsoft elected not to support it.

Why, when C# was designed, did they not want to support optional arguments?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-13T19:54:56+00:00Added an answer on May 13, 2026 at 7:54 pm

    As Andrey says, C# 4 has optional parameters and named arguments. However, it’s worth pointing out that one of the concerns which made Anders reluctant to include them to start with – namely that the default value (which has to be a constant) gets baked into the calling code – is still present. In other words, it’s the same problem as publicly accessible const values from C# 1.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Long version: Those familiar to the standardization nightmare of the RSS-family, may know that
For those who find it too long, just read the bold lines. My project
I need to work with long strings containing line breaks in Java. Those are
Long methods are evil on several grounds: They're hard to understand They're hard to
WARNING: Long and complicated question... So here's the story so far: I'm trying to
Hey guys, I can only apologise for asking such a noob question, but this
I don't know what the correct wording is for what I am trying to
I have these long statements that I will refer to as x,y etc. here.
There's a ListBox with some long items. These long items are getting beyond the
char c='c'; int i=10; double d =50; long l=30; String s=Goodbye; Are these statement

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.