#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jul 2013
    Posts
    1
    Rep Power
    0

    Exclamation Exporting some data as CSV?


    Hello,

    At the moment I have two values in my application which I need to export - fileSize and filePath. I'm using a Dictionary<int, string> to store the values, where the path is determined by the size.

    Now I'm supposed to extract this data as a CSV file, with size and path being the two columns. Any ideas on how could I do that ? (Never worked with csv output, on in fact any file output in C# before)
  2. #2
  3. Contributing User
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jan 2003
    Location
    USA
    Posts
    7,145
    Rep Power
    2222
    It's simply a text file whose fields are separated by a delimiter like a comma or tab. Hence the name, "Comma-Separated Values".

    PS
    From Wikipedia, CSV:
    Originally Posted by Wikipedia
    A comma-separated values (CSV) (also sometimes called character-separated values, because the separator character does not have to be a comma) file stores tabular data (numbers and text) in plain-text form. Plain text means that the file is a sequence of characters, with no data that has to be interpreted instead, as binary numbers. A CSV file consists of any number of records, separated by line breaks of some kind; each record consists of fields, separated by some other character or string, most commonly a literal comma or tab. Usually, all records have an identical sequence of fields.

    A general standard for the CSV file format does not exist, but it is described in RFC 4180 fundamentally. Also the used character encoding is not specified but 7-Bit-ASCII is used as the lowest common denominator.
    You might want to read the rest of that article and perhaps also RFC 4180 for more information and examples. Please note the use of and reasons for quotation marks for string fields.

    When you get an assignment that uses terminology that you are not familiar with, you should look it up. Anymore, STFW ("Search The Web!") is replacing RTFM ("Read The Manual!").
    Last edited by dwise1_aol; July 18th, 2013 at 10:32 AM.

IMN logo majestic logo threadwatch logo seochat tools logo