-1
colDiffUpdated和colDiffTarget有不同的价值观,我怎么可以添加到colTypes两个列表的区别?比较列表<object1>和列表<object2>
假设每个列表都有不同的值。
public List<columnTypes> colType = new List<columnTypes>();
public List<coldiffTypes> colDiffUpdated = new List<coldiffTypes>();
public List<coldiffTypesTarget> colDiffTarget = new List<coldiffTypesTarget>();
这是我存放的价值类
public class columnTypes
{
public string tblName { get; set; }
public string colName { get; set; }
public int maxLength { get; set; }
public string maxLengthStr { get; set; }
public bool isUnique { get; set; }
public bool isKey { get; set; }
public System.Type dataType { get; set; }
public bool isNullable { get; set; }
public bool isAutoIncrement { get; set; }
public string dataTypeName { get; set; }
public int numericPrecision { get; set; }
public int numericScale { get; set; }
}
public class coldiffTypes
{
public string tblName { get; set; }
public string colName { get; set; }
public int maxLength { get; set; }
public string maxLengthStr { get; set; }
public bool isUnique { get; set; }
public bool isKey { get; set; }
public System.Type dataType { get; set; }
public bool isNullable { get; set; }
public bool isAutoIncrement { get; set; }
public string dataTypeName { get; set; }
public int numericPrecision { get; set; }
public int numericScale { get; set; }
}
public class coldiffTypesTarget
{
public string tblName { get; set; }
public string colName { get; set; }
public int maxLength { get; set; }
public string maxLengthStr { get; set; }
public bool isUnique { get; set; }
public bool isKey { get; set; }
public System.Type dataType { get; set; }
public bool isNullable { get; set; }
public bool isAutoIncrement { get; set; }
public string dataTypeName { get; set; }
public int numericPrecision { get; set; }
public int numericScale { get; set; }
}
我错了,还是这三个类完全一样?为什么不为所有三个列表使用单个类? – Groo
这些类以某种方式生成?他们可以从一个基类派生或至少实现相同的接口? – Corak
这里不仅价值不同..整个合同是不同的。 –