Snippets created by Rainer Schuster

  • Hosting the DLR with IronPython or Ruby

    Definition of the dynamic resolution operators for hosting the DLR. You can either use Ruby or Python, as the module isn't language specific.

    4 people like this

    Posted: 12 years ago by Rainer Schuster

  • CSV writer

    A simple CSV writer implementation as two type extensions for the Seq module. Use it with Records, Classes and Tuples. Have a look at the modified CSV reader sample from Don Symes Expert F# too http://fssnip.net/3T in order to advance this snippet using the ColumnAttribute This version adds quote enclosure support and support for seq datatype.

    5 people like this

    Posted: 6 years ago by Rainer Schuster

  • CSV reader

    I've modified the CSV sample from Expert F# to my needs. I don't wann be forced to use the csv schema as defined by column rows. Therefore I've done two major modifications. 1. remove the permutation 2. added a new column name option to the ColumnAttribute 3. added a name to csv index mapping So basically you now have 3 options. 1. Don't annotate your record at all and use it as POCO. The order of the record fields is mapped directly to the order in the csv. UPDATE: I don't recommend this any more. As of the writing of this snippet I wasn't aware of the fact, that field order isn't guaranted by the reflection mechanism. 2. Use the index option of the ColumnAttribute. Same as before. 3. Use the name option. This is what I've looked for. I've to deal with tons of csv that has more columns I'm interested in. Have a look at the sample usage below. I've moved the type conversion out of the CsvReader class in order to be easyly expandable with custom type conversation (i.e. for combined column values - denormalized data)

    4 people like this

    Posted: 12 years ago by Rainer Schuster