简体   繁体   English

C#测试列表是否为空()

[英]C# test if list is empty()

How to do it? 怎么做?

Is it list.Count == 0? 它是list.Count == 0吗?

Thanks 谢谢

I think you meant ( Count is a property, not a method): 我想你的意思是( Count是一个属性,而不是一个方法):

list.Count == 0

And the answer is yes. 答案是肯定的。 Microsoft documentation explicitly says: "Retrieving the value of this property is an O(1) operation." Microsoft文档明确指出:“检索此属性的值是O(1)操作。”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM