我发现这个帖子对此进行了一些讨论:Is it possible to add attributes to the generated members of an ExpandoObject instance?
但它似乎只关注电网。
我花了大约 1 个小时在谷歌上寻找这个,但也没有任何运气。有人至少可以确认是否可以做到吗?
最佳答案
您可以创建一个接口(interface)并将属性添加到该接口(interface)。
比使用 Improptu: http://code.google.com/p/impromptu-interface/
IMyInterface instance = Impromptu.ActLike<IMyInferface>(myexpando);
关于c# - 向 ExpandObject 成员变量添加属性?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10978738/