0

I came across C# codes in the following pattern but quite don't get where that Set method comes from.

// obj is an instance of Microsoft's Xrm Entity class
obj.Set("property_name", property_value);

Based on Xrm's Entity class definition, there is no member method called Set.

Can someone give me some light on this?

4

2 回答 2

1

由于 C# 3.0 类可以获得未在类本身中声明的扩展方法。

http://www.c-sharpcorner.com/uploadfile/puranindia/extension-methods-in-C-Sharp-3-0/

我怀疑这里就是这种情况。

于 2012-09-13T16:30:28.407 回答
0

如果您在 Visual Studio 中,您可以右键单击Set呼叫并单击“转到定义”

您至少可以获得您正在使用的任何类的几乎任何成员的元数据文件。

于 2012-09-13T16:19:46.330 回答