方法检查是否为空

编程入门 行业动态 更新时间:2024-10-10 05:24:28
本文介绍了方法检查是否为空的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个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!!

更多推荐

方法检查是否为空

本文发布于:2023-10-18 15:23:26,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1504620.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:为空   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!