本文介绍了如何将int64转换为Nullable< int64>的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
此代码:
let mutable x : Nullable<int64> = new Nullable<int64> 99L let y : int64 = 88L x <- y产生此编译时错误:
该表达式应具有Nullable类型,但此处具有int64类型
This expression was expected to have type Nullable but here has type int64
我了解错误,我想知道的是将 y (88)中的值分配给 x 的正确方法(广播?)是什么?
I understand the error, what I would like to know is what is the correct way (cast?) to assign the value in y (88) to x?
推荐答案使用 System.Nullable 构造函数;例如:
> let mutable x = System.Nullable (99L) let y = 88L x <- System.Nullable y;; val mutable x : Nullable<int64> = 88L val y : int64 = 88L val it : unit = ()更多推荐
如何将int64转换为Nullable< int64>
发布评论