validate parms in my console app

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?cm9kY2hhcg==?=

    validate parms in my console app

    hi all,
    what is the best way to accept and validate 2 dates and an int for my
    console app?
    so far i have:
    if (args.Length==2 )
    //i assume it's a start date and end date
    if (args.Length==1 )
    //i assume it's an int and just add the int amount to the start date and end
    date
    else
    //i default the start date and end date to today's date.

    does this look ok or is there a better way?

    thanks,
    rodchar
  • Joern Schou-Rode

    #2
    Re: validate parms in my console app

    On Wed, 29 Oct 2008 13:56:06 +0100, rodchar
    <rodchar@discus sions.microsoft .comwrote:
    what is the best way to accept and validate 2 dates and an int for my
    console app?
    Have you considered utilizing a third-party API to parse your command line
    arguments? A quick search reveals several such APIs targeting the .NET
    platform:



    The approach you present is definately an option, but it might just blow
    up in terms of maintainability , should you need to extend your application
    in the future.

    --
    Joern Schou-Rode

    Comment

    Working...