-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
這裏不僅價值不同..整個合同是不同的。 –