C# 怎么判断一个数组为空

譬如:string[] temp = p.GetStartAndEndString().ToArray();
当temp的值为string[0]时,我需要结束这个程序,那么要怎么判断出temp值为 string[0]啊??

string[0] 它是数组的第一项内容(属于变量),不是一个常量
首先:你要确定string[0]是什么?
如果temp为空数组时关闭程序
if(temp==null)
{
//退出程序

}
温馨提示:答案为网友推荐,仅供参考
第1个回答  2013-07-26
if(null != temp)
{
if(temp.length == 0)
{
.......
}
}
第2个回答  2013-07-26
if(temp == "string[0]" )
{
退出程序
}
第3个回答  2013-07-26
temp.length == 0
第4个回答  推荐于2016-06-23
if(temp.Length == 0)
{
Application.Exit();
}本回答被提问者采纳