i need to pass the Type as the parameter of the function and use it.
the Extension method is providing a short cut to extract the cell value of the datatable.
hoe to fix it please
the Extension method is providing a short cut to extract the cell value of the datatable.
c# Code:
/// <summary> /// Returns data row information based on key column & keyId value /// </summary> /// <param name="Dt"></param> /// <param name="IDcolumnName"></param> /// <param name="IDvalue"></param> /// <param name="GetColumnName"></param> /// <returns>DataRow</returns> public static DataRow GetCellValueByIdField(this DataTable Dt, String IDcolumnName , Object IDvalue , Type IDcolumnType , String GetColumnName ) { if (Dt == null && Dt.Rows.Count <= 0 ) { return null; } // Here Filed<type> is to be solved // Error @ // where OpRow.Field<IDcolumnType>(IDcolumnName).Equals(IDvalue) // the error is Can't use the type variable , it must be explicit type instead of a variable name var Dr = from OpRow in Dt.AsEnumerable() where OpRow.Field<IDcolumnType>(IDcolumnName).Equals(IDvalue) select OpRow; return Dr.FirstOrDefault(); }