1

I need to create a console application to print some help messages.I have done that but it does not show the results in the default tabular format in console like,

c:\Users\>dir /?
Displays a list of files and subdirectories in a directory.

DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N]
  [/O[[:]sortorder]] [/P] [/Q] [/R] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

  [drive:][path][filename]
              Specifies drive, directory, and/or files to list.

  /A          Displays files with specified attributes.
  attributes   D  Directories                R  Read-only files
               H  Hidden files               A  Files ready for archiving
               S  System files               I  Not content indexed files
               L  Reparse Points             -  Prefix meaning not
  /B          Uses bare format (no heading information or summary).
  /C          Display the thousand separator in file sizes.  This is the
              default.  Use /-C to disable display of separator.
  /D          Same as wide but files are list sorted by column.
  /L          Uses lowercase.
  /N          New long list format where filenames are on the far right.
  /O          List by files in sorted order.
  sortorder    N  By name (alphabetic)       S  By size (smallest first)
               E  By extension (alphabetic)  D  By date/time (oldest first)
               G  Group directories first    -  Prefix to reverse order
  /P          Pauses after each screenful of information.

Do i need to use escape sequences or is there any inbuilt function to display like this.I googled it.But unable to find solution can any one help:)?

4

4 に答える 4

1

@-quoted文字列リテラルを使用する必要があります。

string help = @"
Usage of @-quoted literal:
  1. Escape sequences are not processed
  2. To include double quotes then ""double it""
";
Console.WriteLine(help);
于 2012-09-27T09:55:10.983 に答える