c#

.Net技术 码拜 7年前 (2017-04-28) 1496次浏览
    public Dictionary<string, object> Attributes
{
get
{
if (this._attributes == null)
{
this._attributes = new Dictionary<string, object>(StringComparer.InvariantCultureIgnoreCase);
}
return this._attributes;
}
}
谁能解释一下这段代码?谢谢
解决方案

10

就是对_attributes泛型字典初始化。后面的StringComparer.InvariantCultureIgnoreCase表示字符串与语言相关的方式忽略大小写。

10

首先这是一个封装字段和属性。
应该存在private Dictionary<string, object> _attributes
然后判断_attributes 能否为空,为空就创建这个字典项

CodeBye 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权 , 转载请注明c#
喜欢 (0)
[1034331897@qq.com]
分享 (0)