Is C# 4 optional parameter implementation the same as VB.NET, the optional parameter is compiled on the call site(can cause versioning problems)?
可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
回答1:
Yes.
回答2:
According to SamNg, C#'s default arguments are is compiled at the call site, similar to default parameters in C++.
Yes, it would cause versioning problems. However, optional parameters should be used where it makes sense. In many cases, this means passing null
or default-constructed class to a method or constructor.