views:

88

answers:

2

Is there a better (shorter?) way than the following?

let cpucount = System.UInt16.Parse( reader.GetInt32(3).ToString() )
+1  A: 

I don't know F#, but you could write Convert.ToUint16(reader.GetInt32(3)).

EDIT: According to MSDN, you can cast by writing uint16 reader.GetInt32(3).

SLaks
+4  A: 
let i = uint16 42

See also

MSDN docs

and the 'casts' section of

What does this C# code look like in F#?

Brian
It's unsigned (uint)
Dario