【发布时间】:2013-08-31 01:25:01
【问题描述】:
当我编写带有确定特定长度的参数的函数时,我总是使用uint。因为值是负数是没有意义的。
但我在 .Net 框架中看到了相反的情况(经常)。 例如:http://msdn.microsoft.com/en-us/library/xsa4321w.aspx
将 String 类的新实例初始化为指定的 Unicode 字符所指示的值,该字符重复指定的次数。
public String(
char c,
int count
)
它还指出,当 `count 小于零时,会抛出 ArgumentOutOfRangeException。”
那么为什么不将count 参数设为uint!?
【问题讨论】: