When adding command line arguments from the project's Start Options, the vshost.exe is added as an argument

If I put two arguments in that field, it shows three because it gives me the vshost.exe process as well.

It's throwing off my debugging. Anyone know either a way to fix this or an alternate method of getting the command line arguments in WPF?

I'm currently getting them via:

string[] args = Environment.GetCommandLineArgs();

Answers


The first argument is always the process name.

When you run the exe outside the debugger the first argument will be "MyApplication.exe".

You should start your processing of the command line arguments from index 1.

The first element in the array contains the file name of the executing program. If the file name is not available, the first element is equal to String.Empty. The remaining elements contain any additional tokens entered on the command line.

Source


Need Your Help

mocha testing doesn't work in the yeoman ember generator

ember.js mocha yeoman

I've barely modify the generated code by the ember generator

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.