【问题标题】:Would it be possible to extend the DataColumn.Expression是否可以扩展 DataColumn.Expression
【发布时间】:2010-12-21 02:29:50
【问题描述】:

DataColumn.Expression 是否可以使用扩展方法来支持例如替换功能?

如果是,是否有任何可用的示例代码?

谢谢。

【问题讨论】:

    标签: c# ado.net dataset datacolumn


    【解决方案1】:

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

    如果您不关心要替换的原始字符串源,则可以迭代每个 DataRow 并更新每个项目的列值。

    foreach(var row in yourDataTable.Rows)
    {
        row["colName"] = row["colName"].ToString().Replace("abc", "xyz");
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-02-08
      • 2011-07-30
      • 2018-08-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多