discuz!nt 一些方法里面为什么要使用克隆。

最近看了下 discuz!nt的源代码 发现里面有这样的写法。不太明白为什么要这样写。求高手指定。

        public static DbParameter[] getA(DbConnection connection, string spName)        {            if (connection == null) throw new ArgumentNullException("参数connection为空或不是对象");            using (DbConnection cloneConnection=(DbConnection)((ICloneable)(connection)).Clone())            {               ......            }        }

有点不明白 上面using后面 为什么要这样写。这样写有什么好处吗。如果之下用下面的写法不也是一样的吗?

        public static DbParameter[] getA(DbConnection connection, string spName, bool includeReturnValueParameter)        {            if (connection == null) throw new ArgumentNullException("参数connection为空或不是对象");            using (DbConnection cloneConnection=connection)            {               ......            }        }

感受不同地域不一样的节奏与表象。

discuz!nt 一些方法里面为什么要使用克隆。

相关文章:

你感兴趣的文章:

标签云: