the ArgumentOutofRangeException is thrown whenever u try to access an
array''s memeber
which is out of range. in ur case the problem is that "args[]" array
has nothing in it and its
default length is 0 and its index is -1 Meaning nothing in array. so
when u try to access
a member at position at 0 index it throws the Exception.
Second issue: if u remove return from catch block of outer most try
block
then u encounter a null reference exception.
this is because that after catching ur IndexOutOfRangeException, ur
program continues to
execute, but in case of return statement within this catch block the
main function returns
As ur program has only one function and that is Main and now its
execution is finished hence
ur application also finishes its execution so no error occurs,
while in other case the story is slightly different, the application
continues to execute
and as ur objects are not initialized so the exception is being thrown

Hope this might help u to understand to address the issue

Reply via email to