我使用的是OracleClient
库版本1.0.5000.0,我对该OracleParameter
类及其实现感到困惑ICloneable
.
这是OracleParameter
类的定义:
public sealed class OracleParameter : MarshalByRefObject, IDbDataParameter, IDataParameter, ICloneable { public OracleParameter(); public OracleParameter(string name, object value); public OracleParameter(string name, OracleType oracleType); public OracleParameter(string name, OracleType oracleType, int size); public OracleParameter(string name, OracleType oracleType, int size, string srcColumn); public OracleParameter(string name, OracleType oracleType, int size, ParameterDirection direction, bool isNullable, byte precision, byte scale, string srcColumn, DataRowVersion srcVersion, object value); [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] [RefreshProperties(RefreshProperties.All)] [Browsable(false)] public DbType DbType { get; set; } [RefreshProperties(RefreshProperties.All)] public ParameterDirection Direction { get; set; } [Browsable(false)] [DesignOnly(true)] [EditorBrowsable(EditorBrowsableState.Never)] [DefaultValue(false)] public bool IsNullable { get; set; } [DefaultValue(0)] [Browsable(false)] public int Offset { get; set; } [RefreshProperties(RefreshProperties.All)] public OracleType OracleType { get; set; } [DefaultValue("")] public string ParameterName { get; set; } [DefaultValue(0)] public byte Precision { get; set; } [DefaultValue(0)] public byte Scale { get; set; } [DefaultValue(0)] public int Size { get; set; } [DefaultValue("")] public string SourceColumn { get; set; } public DataRowVersion SourceVersion { get; set; } [DefaultValue("")] [RefreshProperties(RefreshProperties.All)] [TypeConverter(typeof(StringConverter))] public object Value { get; set; } public override string ToString(); }
它实现了System.ICloneable
,但那里没有Clone()
方法.
有谁能解释一下?
在.NET中,您可以使用以下语法显式实现接口成员:
对象System.IClonable.Clone(){}
因此,您只能通过显式转换到预期的接口来使用该方法.
另请参阅 http://msdn.microsoft.com/en-us/library/system.data.oracleclient.oracleparameter.system.icloneable.clone(VS.85).aspx