I am trying to use generic for the first time and trying to typecast my result returned from database to programmer defined data type. 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);
}