[英]java.lang.Long in C#
I'm developing a WCF JSON Web Service which receive data from an Android application. 我正在开发WCF JSON Web服务,该服务从Android应用程序接收数据。
Some data could be null. 一些数据可能为空。 On Android I'm using java.lang.Long , that could be
null
. 在Android上,我使用java.lang.Long ,它可以为
null
。
On C#side, I'm using long
that couldn't be null
. 在C#端,我使用的
long
不能为null
。
Is there a java.lang.Long
type in C#? C#中是否有
java.lang.Long
类型?
Sounds like you want a Nullable<long>
or long?
听起来像您想要
Nullable<long>
还是long?
. 。
long? myLongVar = null;
if (myLongVar == null) // or !myLongVar.HasValue, if you prefer
{
myLongVar = 5L;
long noLongerNullable = myLongVar.Value;
}
在C#中使用Nullable
类型
Long? x;//by default x is now null..you can now assign null to it
You should use long?
你应该用多
long?
aka Nullable<long>
又名
Nullable<long>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.