Question

Could extension method be used for DataColumn.Expression to support for example the replace function ?

If yes, any sample code available somewhere ?

Thanks.

Was it helpful?

Solution

Probably not in the way you're thinking of doing it.

If you don't care about the original string source you're replacing, you could iterate over each DataRow and update the column values for each item instead.

foreach(var row in yourDataTable.Rows)
{
    row["colName"] = row["colName"].ToString().Replace("abc", "xyz");
}
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top