I am trying to use generic for the first time and trying to match my result from the database to the type of data defined by the programmer. How can i do this.
dsb.ExecuteQuery("DELETE FROM CurrencyMaster WHERE CurrencyMasterId="
+ returnValueFromGrid<int>(getSelectedRowIndex(), "CurrencyMasterId"));
private T returnValueFromGrid<T>(int RowNo, string ColName)
{
return Convert.ChangeType(dgvCurrencyMaster.Rows[RowNo].Cells[ColName].Value, T);
}
source
share