C# - 是否有可能有空PARAMS? [英] C# - Is it possible to have null params?
本文介绍了C# - 是否有可能有空PARAMS?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
public void Foo(params string[] values)
{
}
有没有可能是值
可以永远空
,还是会?
Is it possible that values
can ever be null
, or will it always be set with 0
or more items?
推荐答案
当然 - 你可以用字符串[]类型为NULL值的参数调用它:
Absolutely - you can call it with an argument of type string[] with a value of null:
string[] array = null;
Foo(array);
这篇关于C# - 是否有可能有空PARAMS?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文