如何检查缓冲区是否为空 [英] How can I check that buffer is empty or not

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

问题描述





我有整数值列表



列表与LT; INT> buffer1 =  new 列表< int>(); 





现在我需要检查buffer1是否为空



谢谢

John

解决方案

请参阅 http://msdn.microsoft.com/en-us/library/ 6sh2ey19(v = vs.110).aspx [ ^ ]。


使用计数 [ ^ ]属性。如果 Count 为零,则列表为空。


  if (buffer1.Count ==  0 
{
//
}
其他
{
// 不为空..
}


Hi,

I have list of integer values

List<int> buffer1 = new List<int>();



Now I need to check buffer1 is empty or not

Thanks
John

解决方案

See http://msdn.microsoft.com/en-us/library/6sh2ey19(v=vs.110).aspx[^].


Use the Count[^] property. If Count is zero then the list is empty.


if (buffer1.Count == 0)
        {
            // empty
        }
        else
        {
            // not empty..
        }


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

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