zoukankan
html css js c++ java
Params参数的应用
public
partial
class
Form1 : Form
...
{
public
static
void
UseParams(
params
int
[] list)
...
{
string
temp
=
""
;
for
(
int
i
=
0
; i
<
list.Length; i
++
)
temp
=
temp
+
"
"
+
list[i].ToString();
MessageBox.Show(temp);
}
public
static
void
UseParams2(
params
object
[] list)
...
{
string
temp
=
""
;
for
(
int
i
=
0
; i
<
list.Length; i
++
)
temp
=
temp
+
"
"
+
list[i].ToString();
MessageBox.Show(temp);
}
public
Form1()
...
{
InitializeComponent();
}
private
void
button1_Click(
object
sender, EventArgs e)
...
{
UseParams(
1
,
2
,
3
);
//
看参数是3个
UseParams(
1
,
2
);
//
看参数是2个,可变吧
UseParams2(
1
,
'
a
'
,
"
test
"
);
int
[] myarray
=
new
int
[
3
]
...
{
10
,
11
,
12
}
;
UseParams(myarray);
//
看也可以是容器类,可变吧:)
}
}
查看全文
相关阅读:
C# 实现向指定邮箱发送信息功能
asp.net webapi 解决跨域问题
电脑通电自动开机设置
C# 多个控件绑定一个事件
C# DataGridView 标题栏背景颜色改变
C# 输出csv文件后缀乱码
C# textbox设定为只读后如何改变文本字体颜色
C# 命名规则
C# 傅里叶变换 逆变换 调用MathNet包
使用SharpDevelop配合MonoGame进行游戏开发
原文地址:https://www.cnblogs.com/xiaobaigang/p/844497.html
最新文章
ASP.NET Core 中的中间件
.NET 中文件嵌套,例如:cshtml文件下面嵌套css和js【机器翻译】
docker 安装mongodb
JWT
从 ASP.NET Core 3.1 迁移到 5.0
asp.net core 认证&授权:Claim+ClaimsIdentity+ClaimsPrincipal
【喜提.net 5】.NET 5.0-preview.1 发布啦
【喜提.net 5】.NET 5.0-preview.1 发布啦
docker 安装 mysql
K8S
热门文章
EntityFrameworkCore
Hadoop+HBase
Jenkins
Docker
IIS
DDD是什么?
RESTFU API是什么?
使用docker部署asp.net core web 应用程序
POP、OOP、AOP的区别?
抽象类和接口的区别有哪些?
Copyright © 2011-2022 走看看