简单名称值对节点类NameValuePair
本类位于System.Data.dll中,名为:System.Data.Common.NameValuePair。主要用途是在DBConnectionString类中,解析ConnectionString时存储并串联Name/Value对。框架类中没有使用Collection名称空间下的通用集合类,应该是出于效率和便于持久化方面的考虑。
[Serializable]
public
sealed
class NameValuePair
{
private readonly string _name;
private NameValuePair _next;
private readonly string _value;
public NameValuePair(string name, string value)
{
if ( StringHelper.IsEmpty(name) )
{
throw new ArgumentException(“name”);
}
this._name = name;
this._value = value;
}
public NameValuePair(string name, string value, NameValuePair next) : this(name, value)
{
this._next = next;
}
public NameValuePair Clone()
{
return new NameValuePair(this._name, this._value);
}
public string Name
{
get { return this._name; }
}
public NameValuePair Next
{
get
{
return this._next;
}
set
{
if ( this._next != null )
{
throw new InvalidOperationException();
}
this._next = value;
}
}
public string Value
{
get
{
return this._value;
}
}
}
public
sealed
class NameValuePair
{
private readonly string _name;
private NameValuePair _next;
private readonly string _value;
public NameValuePair(string name, string value)
{
if ( StringHelper.IsEmpty(name) )
{
throw new ArgumentException(“name”);
}
this._name = name;
this._value = value;
}
public NameValuePair(string name, string value, NameValuePair next) : this(name, value)
{
this._next = next;
}
public NameValuePair Clone()
{
return new NameValuePair(this._name, this._value);
}
public string Name
{
get { return this._name; }
}
public NameValuePair Next
{
get
{
return this._next;
}
set
{
if ( this._next != null )
{
throw new InvalidOperationException();
}
this._next = value;
}
}
public string Value
{
get
{
return this._value;
}
}
}
今天的文章NameValuePair分享到此就结束了,感谢您的阅读。
版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 举报,一经查实,本站将立刻删除。
如需转载请保留出处:https://bianchenghao.cn/23942.html