当我尝试使用 APN 构建某些东西时,我看到了这个代码块。有人可以解释一下“this”语句在那里做什么吗?
public ApplePushService(IPushChannelFactory pushChannelFactory, ApplePushChannelSettings channelSettings)
: this(pushChannelFactory, channelSettings, default(IPushServiceSettings))
它像这些参数的默认值吗?
this
使用指定参数调用 ApplePushService 类的重载构造函数。
例如
// Set a default value for arg2 without having to call that constructor
public class A(int arg1) : this(arg1, 1)
{
}
public class A(int arg1, int arg2)
{
}
这使您可以调用一个可以调用另一个构造函数的构造函数。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)