Customize DataColumn.Expression handling in C#

大城市里の小女人 提交于 2019-12-04 12:21:32

Not possible. The expression parser behind the Expression property is simple and not extensible. Making arbitrary function calls is not one of its capabilities. There are several ways to work around this, especially ones that don't require an expensive reflection lookup. Consider the DataTable.RowChanged event for example.

A way around this is to make your function a calculated field like in databases and spredsheets. It is possible to make advanced calculated fields. You need to rewrite your function to an expression and then use [Price] to refer to the source column. As I understand your question it makes it possible to do what you intend. The syntax for expression can be found here.

I know this is a late answer to the question but it might help others looking into how to do this.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!