给定以下课程:
public class MyClass
{
private string _param;
public MyClass ()
{
_param = string.Empty;
}
public MyClass (string param)
{
_param = param;
}
}
我在链接这些构造函数的两种方法之间被撕裂:
第一个:
public MyClass () : this (string.Empty)
{
}
public MyClass (string param)
{
_param = param;
}
第二个:
public MyClass ()
{
_param = string.Empty;
}
public MyClass (string param) : this ()
{
_param = param;
}
那么,从无参数构造函数中链接更好还是相反?