views:

87

answers:

1

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

If yes, any sample code available somewhere ?

Thanks.

+1  A: 

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");
}
Mike Atlas