开发者

How to convert from System.Int32 to System.UInt16 in F#

开发者 https://www.devze.com 2022-12-23 09:23 出处:网络
Is there a better (sho开发者_运维知识库rter?) way than the following? let cpucount = System.UInt16.Parse( reader.GetInt32(3).ToString() )

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).

0

精彩评论

暂无评论...
验证码 换一张
取 消