剂量C#2.0支持可选参数 [英] Dose C#2.0 support optional parameters
本文介绍了剂量C#2.0支持可选参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
C#2.0是否支持VB.NET等可选参数:
函数MyFunction(可选ByVal isCenter As Boolean = False)
Does C#2.0 support optional parameters like VB.NET:
Function MyFunction(Optional ByVal isCenter As Boolean = False)
推荐答案
查看类似功能的params关键字
ad写道:
see the params keyword for similar functionality
ad wrote:
C#2.0是否支持可选参数,如VB.NET:
功能MyFunction(可选ByVal isCenter As Boolean = False)
Does C#2.0 support optional parameters like VB.NET:
Function MyFunction(Optional ByVal isCenter As Boolean = False)
我见过:
参数keyword允许你指定一个方法参数,该参数带有一个参数数量可变的
参数。
但它与VB.Net的可选参数不同
" wbekker" < w.bekker@REMOVEequanimityTHISdotnl>
????????:42 *********************** @新闻.xs4all.nl ..。
I have seen it:
The params keyword lets you specify a method parameter that takes an
argument where the number of arguments is variable.
But it is different from optional parameters of VB.Net
"wbekker" <w.bekker@REMOVEequanimityTHISdotnl>
???????:42***********************@news.xs4all.nl.. .
查看类似功能的params关键字
ad写道:
see the params keyword for similar functionality
ad wrote:
C#2.0是否支持VB等可选参数.NET:
函数MyFunction(可选ByVal isCenter As Boolean = False)
Does C#2.0 support optional parameters like VB.NET:
Function MyFunction(Optional ByVal isCenter As Boolean = False)
否则我就是害怕你被这种结构所困扰:
public void MyFunction(bool isCenter)
{
//地方代码这里
}
public void MyFunction()
{
MyFunction(false); < br $>
}
Ward
ad写道:
Otherwise i''m afraid you are stuck with this kind of construction:
public void MyFunction(bool isCenter)
{
//place code here
}
public void MyFunction()
{
MyFunction(false);
}
Ward
ad wrote:
我见过:
params关键字允许您指定一个方法参数,该参数采用
参数,其中参数的数量是可变的。
但它与可选参数不同米的VB.Net
" wbekker" < w.bekker@REMOVEequanimityTHISdotnl>
???????:42***********************@news.xs4all.nl ..
I have seen it:
The params keyword lets you specify a method parameter that takes an
argument where the number of arguments is variable.
But it is different from optional parameters of VB.Net
"wbekker" <w.bekker@REMOVEequanimityTHISdotnl>
???????:42***********************@news.xs4all.nl.. .
查看类似功能的params关键字
ad写道:
see the params keyword for similar functionality
ad wrote:
C#2.0是否支持可选参数如VB.NET:
函数MyFunction(可选ByVal isCenter As Boolean = False)
Does C#2.0 support optional parameters like VB.NET:
Function MyFunction(Optional ByVal isCenter As Boolean = False)
这篇关于剂量C#2.0支持可选参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文