2012-11-21 105 views
0

我有下面提到的编码。我想从这个数组中获取response_text和response_code的值。任何人都可以帮助我如何获得特定的关键值。使用密钥的名称从数组中获取值

stdClass Object 
(
    [_OPS_version] => 0.9 
    [protocol] => XCP 
    [request_response_time] => 0.441 
    [response_text] => Command completed successfully 
    [is_search_completed] => 1 
    [action] => REPLY 
    [attributes] => stdClass Object 
     (
      [suggestion] => stdClass Object 
       (
        [count] => 0 
        [response_text] => Missing tld list, supported tlds are [.com,.net,.org,.info,.biz,.us,.mobi] 
        [response_code] => 500 
        [is_success] => 0 
       ) 

     ) 

    [response_code] => 200 
    [is_success] => 1 
) 

在此先感谢

回答

0

使用的命名空间的System.Reflection,请尝试使用的PropertyInfo []信息= stdClass.GetProperies(),则刚刚经历的每个属性循环,并检查调试模式的价值。

+0

u能请一个示例演示如何使用命名空间解释说,一个 –

+0

的PropertyInfo [] myPropertyInfo; //获取'Type'类对象的属性。 myPropertyInfo = .GetProperties(); (int i = 0; i GiantHornet

+0

供您参考,http://msdn.microsoft.com/en-us/library/aky14axb.aspx – GiantHornet

相关问题