c# - What does args 0 store in this program -
what code in example, args[0]
store? if want access path directory, can not though i'm pretty sure im making mistake on same line.
string directorypath = args[0];
this code:
class program { static void main(string[] args) { string directorypath = args[0]; string[] fileslist, fileslisttmp; ifileoperation[] oplist = { new fileprocnameafter10(), new fileprocenc(), new fileprocbyext("jpeg"), new fileprocbyext("jpg"), new fileprocbyext("doc"), new fileprocbyext("pdf"), new fileprocbyext("djvu") }; if (directory.exists(directorypath)) { fileslist = directory.getfiles(directorypath); while (true) { thread.sleep(500); fileslisttmp = directory.getfiles(directorypath); foreach (var elem in enumerable.except<string>(fileslisttmp, fileslist)) { console.writeline(elem); foreach (var op in oplist) { if (op.accept(elem)) op.process(elem); } } fileslist = fileslisttmp; if (console.keyavailable == true && console.readkey(true).key == consolekey.escape) break; } } else { console.writeline("there no such directory."); console.readkey(); } } }
what args 0 store in program
its command line parameter, value in if execute exe
command line parameters.
for debugging purpose can send through visual studio well, go project properties, debug , under start option specify.
Comments
Post a Comment