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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T18:49:26+00:00 2026-06-09T18:49:26+00:00

I have created a method which gives different message box output results depending on

  • 0

I have created a method which gives different message box output results depending on the passed command line arguments.

Currently I have to start debugging every time I want to change the command line arguments string.

Is there a way to change the command line arguments during a debugging session?

EDIT: I’ve added some sample code

private static class MyParsers
    {

    public static List<string> args;

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

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

        public static List<string> ParseOptions(bool caseSensitive)
        {
            return caseSensitive
                   ? args
                   : args.MyExtToLower();
        }

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

        public static bool OptionExists(string option, bool caseSensitive)
        {
            return caseSensitive
                       ? ParseOptions().Contains(option)
                       : ParseOptions().MyExtToLower().Contains(option);
        }

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

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

Then I call MessageBox.Show(MyParsers.OptionExists("/list","=").ToString());

If the command line argument is /list=blah it returns true.

If the command line argument is /listary it returns false.

What method would you suggest for quickly altering the command line parameters? considering the above code I am using.

  • 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-09T18:49:28+00:00Added an answer on June 9, 2026 at 6:49 pm

    The commandline that a process was started with cannot be changed. However, you could copy your arguments into an easily-accessible “settings” object early in your application, and then manipulate that instead.

    EDIT: Instead of the properties in your object parsing the command line every time you call them, change the properties to regular properties. Then have an Initialise method (or use the constructor, even) so that you parse the command line just once at startup. Then, you can use the immediate window to change the values of your properties at will, because they’re not referring back to the command line every time.

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

Sidebar

Related Questions

I have created a Webpage which will post as post method..not as get method.
I have created a custom shipping method to show depo-names from which customers will
I have created a class library called AddServiceLibrary in which I have a method
I have created a class which extends Gallery. There is no onCreate() method in
We have repositories which have a Save method. They also throw a Created event
I have a winforms, and it connecting wit webservice. Webservice has method which create
I'm developing an ASP.NET forms webapplication using C#. I have a method which creates
I have a web service method in which I create a particular type of
I create small application which is media player. I have method where I have
Hi I want to create a WCF service that have login method, which is

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.