Why does C # does not provide "default parameters"

zhaozj2021-02-16  105

On the forum, I often see the problem with the default parameters in C #.

C # Team's blog See

An article in Eric Gunnerson

Why doesn't C # Support default parameters?

After reading it, I think of the original TOString function that INT32 is used to use the reflector. The three overloaded function code is:

public

Override

String

Tostring ()

{Return this.tostring (null, null);

public

String

Tostring

String

Format)

{Return this.tostring (Format, null);

public

String

Tostring

String

Format, IFORMATPROVIDER Provider

{Return Number.Formatint32 (this.m_value, format, numberformatinfo.getinstance (provider);}

At that time, just like this definition can reduce the amount of code, which is compared to the call, but I didn't expect to have a relationship with the default parameters.

转载请注明原文地址:https://www.9cbs.com/read-10713.html

New Post(0)