自DataColumn.Ex pression处理在C#DataColumn、Ex、pression

由网友(不想成为俗世之人°)分享简介:我想改变 DataColumn.Ex pression 的行为,这样,当我写的:I would like to change behavior of DataColumn.Expression so that when I write:DataColumn.Expression = "MyMethod(Price)...

我想改变 DataColumn.Ex pression 的行为,这样,当我写的:

I would like to change behavior of DataColumn.Expression so that when I write:

DataColumn.Expression = "MyMethod(Price)"

这会调用的MyMethod,通过从价格列值到它,并显示评估值。

It will call MyMethod, pass value from Price column into it and display evaluated value.

我怎么能acomplish呢?

How can I acomplish this?

推荐答案

不可能的。防爆pression财产背后的EX pression解析器简单,不可扩展的。制作任意函数调用并不是它的功能之一。有几种方法来解决这个问题,特别是那些不要求昂贵的反射查找。考虑DataTable.RowChanged事件为例。

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.

阅读全文

相关推荐

最新文章