可选参数可为空
Optional parameter nullable
上下文:
在 Axe 中,我公开了一个网络服务。该方法有 3 个参数。其中两个应该是 Nullable<>
但我在 X++ 中没有这样做。
在 c# 中,代码如下所示:
private static void FooBar(string[] things, DateTime? d1, DateTime? d2)
{
if (d1 == null || d2 == null)
{
//Do Something
}
else {
//Something Else
}
}
我怎么翻译这个?如何使用构建可选的可为空参数构建方法?
在 X++ 中使用方法重载 not suported。
这应翻译成以下内容:
private static void FooBar(str things[], utcdatetime d1 = DateTimeUtil::minValue(), utcdatetime d2 = DateTimeUtil::minValue())
{
if(d1!=DateTimeUtil::minValue()||d2!=DateTimeUtil::minValue())
{
//do something
}
else
{
//something else
}
}
things
是必须的,d1
& d2
是可选的
上下文:
在 Axe 中,我公开了一个网络服务。该方法有 3 个参数。其中两个应该是 Nullable<>
但我在 X++ 中没有这样做。
在 c# 中,代码如下所示:
private static void FooBar(string[] things, DateTime? d1, DateTime? d2)
{
if (d1 == null || d2 == null)
{
//Do Something
}
else {
//Something Else
}
}
我怎么翻译这个?如何使用构建可选的可为空参数构建方法?
在 X++ 中使用方法重载 not suported。
这应翻译成以下内容:
private static void FooBar(str things[], utcdatetime d1 = DateTimeUtil::minValue(), utcdatetime d2 = DateTimeUtil::minValue())
{
if(d1!=DateTimeUtil::minValue()||d2!=DateTimeUtil::minValue())
{
//do something
}
else
{
//something else
}
}
things
是必须的,d1
& d2
是可选的