【发布时间】:2013-06-30 15:02:53
【问题描述】:
我正在遍历动态对象的属性以查找字段,但我无法弄清楚如何在不引发异常的情况下安全地评估它是否存在。
foreach (dynamic item in routes_list["mychoices"])
{
// these fields may or may not exist
int strProductId = item["selectedProductId"];
string strProductId = item["selectedProductCode"];
}
【问题讨论】:
-
你为什么要使用foreach(动态项ant to just var
标签: c#