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 8380043
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T16:21:15+00:00 2026-06-09T16:21:15+00:00

I am working on my own command line arguments parser and after reading dozens

  • 0

I am working on my own command line arguments parser and after reading dozens of articles regarding method overloading I am still not certain if I am doing it right.

Am I getting any benefit from overloading methods this way? I know I could just write the entire thing in a single method (with default value parameters) by branching, but I’m experimenting overloads at the moment and I would like to know whether to continue on this path or not.

    public static class MyParsers
    {
        private static List<string> args;

        static MyParsers()
        {
            args = Environment.GetCommandLineArgs().ToList();
        }

        public static List<string> ParseOptions()
        {
            return ParseOptions(false);
        }

        public static List<string> ParseOptions(bool toLowercase)
        {
            // DEBUG: Change command line arguments here.
            var arguments = args;
            return !toLowercase
                       ? arguments
                       : arguments.MyExtToLower();
        }

        public static bool OptionExists(string option)
        {
            return OptionExists(option, false);
        }

        public static bool OptionExists(string option, bool toLowercase)
        {
            var list = ParseOptions(toLowercase);
            for (var i = 1; i < list.Count; i++)
            {
                if (list[i].StartsWith(option)) return true;
            }
            return false;
        }

}
  • 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-06-09T16:21:17+00:00Added an answer on June 9, 2026 at 4:21 pm

    Yes that is the correct way to use overloads.

    One thing to note about default parameters.

    If you have two assemblies, A and B, A calls the function in B.

    If you change the default in B:

    using default values for parameters you need to recompile both assembly A and B for this change to take effect

    using overloads you only need to recompile B.

    This is because for default parameters, at compile time the compiler inserts the default values.

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

Sidebar

Related Questions

I'm working on writing my own string class and am having trouble with overloading
So, I am working on a Linux based command line utility, that has to
I'm working on a command line application for Solaris, written in Java6. I'd like
I've got a fairly simple query that I have working in command line, and
I'm currently working on a small utility program that only requires a command line
I am working on my own Lorem Ipsum generator, with the added bonus of
I'm working on my own text editor in silverlight. I made different functions to
I've been working on my own django based blog (like everyone, I know) to
I am currently working on my own implementation of a tab bar for a
I am developing an MFC application. I am working with my own .bmp image

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.