首页 > 其他 > 详细

简单名称值对节点类NameValuePair

时间:2015-04-27 11:10:27      阅读:111      评论:0      收藏:0      [点我收藏+]

本类位于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;
技术分享        }
技术分享    }
技术分享}

简单名称值对节点类NameValuePair

原文:http://www.cnblogs.com/Look_Sun/p/4459526.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!