自DataColumn.Ex pression处理在C# [英] Customize DataColumn.Expression handling in C#

查看:102
本文介绍了自DataColumn.Ex pression处理在C#的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想改变 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.

这篇关于自DataColumn.Ex pression处理在C#的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆