Initial commit
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
概念:
|
||||
解决函数传递时需要传递多个(不确定具体个数)参数的问题
|
||||
|
||||
通常用法:
|
||||
|
||||
|
||||
语法:
|
||||
关键字:params
|
||||
|
||||
案例:
|
||||
```Csharp
|
||||
static int Sum(params int[] arr)
|
||||
{
|
||||
//具体方法
|
||||
return value;
|
||||
}
|
||||
|
||||
Sum(1,2,3,4,5,6,7); //都会存入arr里
|
||||
```
|
||||
注意:
|
||||
==params关键字后面必须是数组==
|
||||
==最多只能有1个变长参数 且必须放在末尾==
|
||||
#基础
|
||||
Reference in New Issue
Block a user