How to convert from System.Int32 to System.UInt16 in F#
Is there a better (sho开发者_运维知识库rter?) way than the following?
let cpucount = System.UInt16.Parse( reader.GetInt32(3).ToString() )
let i = uint16 42
See also
MSDN docs
and the 'casts' section of
What does this C# code look like in F#?
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)
.
精彩评论