Rational不支持可选参数 [英] Rational for not supporting optional arguments

查看:83
本文介绍了Rational不支持可选参数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

任何人都可以告诉我不支持可选的

参数是什么理由。


实现这显然是一件微不足道的事情,因为C ++已经有了他们,我不希望在没有充分理由的情况下省略它们。

Can anyone tell me what the rational is for not supporting optional
arguments.

It is obviously a trivial thing to implement and, since C++ has them, I
would not expect them to be omitted without a good reason.

推荐答案

可选参数没有写入公共语言规范,

因此并非所有.NET语言都能理解它们。我相信

C#意味着符合CLS,因此不支持可选参数。


" Nick Hounsome"写道:
Optional parameters was not written into the Common Language Specification,
so therefore not all .NET languages are able to understand them. I believe
C# is meant to be CLS compliant, and so no support for optional parameters.

"Nick Hounsome" wrote:
任何人都可以告诉我不支持可选的
论证是什么理由。

这实际上是一件微不足道的事情,由于C ++有它们,我不希望它们在没有充分理由的情况下被省略。
Can anyone tell me what the rational is for not supporting optional
arguments.

It is obviously a trivial thing to implement and, since C++ has them, I
would not expect them to be omitted without a good reason.





rmacias < RM ***** @ newsgroup.nospam>在留言中写道

新闻:7F ********************************** @ microsof t.com ...

"rmacias" <rm*****@newsgroup.nospam> wrote in message
news:7F**********************************@microsof t.com...
可选参数未写入公共语言
规范,因此并非所有.NET语言都能理解它们。我相信
C#意味着符合CLS,因此不支持可选的
参数。


C#充满了非CLS兼容功能。


可选参数甚至可以符合CLS。如果它是明确的,那么
表示编译器会产生等效的重载 - 它的价值比生成魔法的魔法少得多。物业方法和

事件访问。

" Nick Hounsome"写道:
Optional parameters was not written into the Common Language
Specification,
so therefore not all .NET languages are able to understand them. I
believe
C# is meant to be CLS compliant, and so no support for optional
parameters.
C# is full of non-CLS compliant features.

Optional parameters can even be made "CLS compliant" if it is explicitly
stated that the compiler will generate the equivalent overloads - it''s
considerably less magical than generating "magic" methods for property and
event access.
"Nick Hounsome" wrote:
任何人都可以告诉我不支持可选的
论证是什么理由。

这实际上是一件微不足道的事情,由于C ++有它们,我不希望它们在没有充分理由的情况下被省略。
Can anyone tell me what the rational is for not supporting optional
arguments.

It is obviously a trivial thing to implement and, since C++ has them, I
would not expect them to be omitted without a good reason.



Nick Hounsome写道:
Nick Hounsome wrote:
任何人都可以告诉我不支持可选的
参数是什么理由。

实现这显然是一件微不足道的事情,因为C ++有他们,我不希望在没有充分理由的情况下省略它们。
Can anyone tell me what the rational is for not supporting optional
arguments.

It is obviously a trivial thing to implement and, since C++ has them, I
would not expect them to be omitted without a good reason.




我相信大多数版本。因为默认值最终将* b $ b加到*调用*程序集中,如果新版本的程序集出现

且具有不同的默认值,则最终会出现问题。


Jon



Mostly versioning, I believe. Because the default values end up baked
into the *calling* assembly, if a new version of the assembly comes out
with different default values, you end up with problems.

Jon


这篇关于Rational不支持可选参数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆