将属性设置为对外访问只读,对内可写,同时设置默认值。举例:
public string DL_PointA { get; private set; } = "2054325";
初始化字典类型的属性:
private static Dictionary<string, string> _scs_Dic;
public static Dictionary<string, string> scs_Dic
{
get
{
if (_scs_Dic == null)
{
_scs_Dic = new Dictionary<string, string>();
}
return _scs_Dic;
}
private set { value = _scs_Dic; }
}