I am not able to google for as, as 开发者_JAVA技巧Google blocks out symbols.
it appeared in this context:
Console.WriteLine("Usage: findduplicatefiles [/sub] DirectoryName [DirectoryName]...");
Thanks :)
It doesn't mean anything in C#. All that Console.WriteLine()
call does is write this string:
"Usage: findduplicatefiles [/sub] DirectoryName [DirectoryName]..."
into the console as output.
However, in the Windows command line, /
functions as a command-line argument delimiter, and []
means it's an optional argument. The usage prompt is telling the user that sub
is an optional argument to use with the findduplicatefiles
program.
Examples:
Run
findduplicatefiles.exe
against the current directory:C:\>findduplicatefiles .
Run
findduplicatefiles.exe
against the current directory with thesub
argument:C:\>findduplicatefiles /sub .
Run
findduplicatefiles.exe
against two directories,C:\abc
andC:\def
, with thesub
argument:C:\>findduplicatefiles /sub abc def
"[/" in a string doesn't mean anything to C#. It just writes those characters out. But I think you are confused about the meaning of what is being written out.
There is a convention when documenting command-line programs where putting an argument in square braces means the argument is optional. Thus, the string your program is writing out indicates that the command findduplicatefiles
may optionally have an argument /sub
after which it must have at least one directory name, and may optionally have other directory names.
In this case is does not mean anything to C#. It's just a character in the string just like the rest of the string.
Means optionally put /sub
before directoryName. It is not a C# question.
精彩评论