Friday 29 June 2012

That Good 'Ol String[] args!

OK, so you want to write a command-line program. It can't be a  very flexible / interesting program if it doesn't accept some command line parameters.

But how do you handle common issues (like optional arguments, for example). Is there an elegant way to process these in C#?

You could do separate cases e.g. if args.length ==2, 3 etc. do something different.

No comments: