Skip to content

Instantly share code, notes, and snippets.

@giuliohome
Last active May 28, 2017 14:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save giuliohome/cba2ddeef14226a0997d8daeb0a816a7 to your computer and use it in GitHub Desktop.
Save giuliohome/cba2ddeef14226a0997d8daeb0a816a7 to your computer and use it in GitHub Desktop.
// https://dotnetfiddle.net/sjSjeS
open System
open System.Data
open System.Xml
open Microsoft.FSharp.Linq
type RowReader(reader:DataRow) =
member private x.Reader = reader
static member (?) (x:RowReader, name:string) : 'R =
x.Reader.[name] :?> 'R
printfn "Hello World"
let z = "name"
let table = new DataTable()
let col = new DataColumn()
col.ColumnName <- z
col.DataType <- System.Type.GetType("System.Double")
table.Columns.Add col
let x = table.NewRow()
let xx = RowReader(x)
x.[z] <- 7.
printf "check %f" (x.[z] :?> double)
let comm = 3.
let y = if x.IsNull(z) then Nullable() else xx?name ?* comm
printfn "\ny: %f" y.Value
@giuliohome
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment