本文介绍了方法检查是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个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!!
更多推荐
方法检查是否为空
发布评论