I developed .net console applications using C # and always just determined which order parameters to insert, so args [0] is always the start date, and args [1] is always the end date, for example.
however, I would like to move on to using named parameters so that any combination of parameters can be sent in any order, for example, the typical "-sd" start date prefix.
I know that I could analyze the arguments of [], looking for “-”, and then read the name and look at the next position for the accompanying value, but before you do this, you need to find out if there is any method, this is pretty standard practice.
is there something like this out there that could do as such:
DateTime startDate = (DateTime)((ConsoleParameters)args[])["sd"]
I am using C # and .Net 4
source
share