How do I access an anonymous object's properties outside its scope?

前端 未结 4 1079
终归单人心
终归单人心 2021-01-25 19:08

Scope might not be the right word. With the following code I can\'t get access to the collections element\'s object\'s properties. Is there a better return data type or a way t

4条回答
  •  我在风中等你
    2021-01-25 19:42

    There are two feasible solutions:

    1. Create a real class for it. That's the prefered solution.
    2. Make your method return dynamic instead of object. The problem with this is that you lose compile time checking of the code that uses the result of this method.

提交回复
热议问题