In my class I have private variables and properties like this.
private string _itemCOde=string.Empty;
private string _itemName=string.Empty;
public string ItemCode
{
get { return _itemCode; }
set { _itemCode = value == null ? value : value.Trim();}
}
public string ItemName
{
get { return _itemName; }
set { _itemName = value == null ? value : value.Trim();}
}
According to this properties I create Item objects after selecting the data from the sql table.
Now, if database table altered and add a new column called cost, then I have to add another property to the class. Without adding new properties to the class is there any way do declare properties according to the table fields dynamically.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…