我正在开发一个 WCF JSON Web 服务,它从 Android 应用程序接收数据。
某些数据可能为空。在 Android 上我使用 java.lang.Long ,可能为 null
。
在 C# 端,我使用的 long
不能为 null
。
C# 中有 java.lang.Long
类型吗?
最佳答案
听起来你想要一个 Nullable<long>
或long?
.
long? myLongVar = null;
if (myLongVar == null) // or !myLongVar.HasValue, if you prefer
{
myLongVar = 5L;
long noLongerNullable = myLongVar.Value;
}
关于c# - C# 中的 java.lang.Long,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13294181/