方法检查是否为空 [英] Method checking if it is empty

查看:84
本文介绍了方法检查是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有一个wcf服务,该服务正在返回方法的输出.我正在检查天气是否为空



Hi,

I have a wcf service which was returning the output of a method. i am checking weather it is empty or not



if(objRec.System[]="" )
{

}




它向我抛出了一个错误语法错误;期望值" .... in]"


问候,
Basha




It was throwing me a error "syntax error; value expected"....in "]"


Regards,
Basha

推荐答案

objRec.System[]不是有效的对象引用;添加索引值以告诉编译器您要引用的元素.
objRec.System[] is not a valid object reference; add an index value to tell the compiler which element you are referring to.


if(objRec.System[]="" )
{

}



如果要在数组中查找带有的值,则应具有数组索引,否则,如果要检查数组是否为空,请执行以下操作.




if you are looking for a value with in the array you should have an array index, or else if you would like to check if the array is empty or not do the following.


if(objRec.System.Count == 0 )
{

}




希望对您有帮助!




Hope it helps!!


这篇关于方法检查是否为空的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆