2014-03-25 114 views
-2

我持有一个键值对这样的键值对像下面如何从C#中的对象访问嵌套键值对?

Key 
- Value[Hash dictionary which has a key value pair as below] 
     - Key 
      - Value 

我的问题是我如何才能在C#中的所有键和值相干缓存对象。

代码:

string parent = ((Tangosol.Util.ConverterCollections.AbstractConverterCacheEntry)(cacheItem)).Key.ToString(); 
object child = (((Tangosol.Util.ConverterCollections.AbstractConverterCacheEntry)(cacheItem)).Value); 
object i = (((Tangosol.Util.Collections.HashDictionary)(((Tangosol.Util.ConverterCollections.AbstractConverterCacheEntry)(cacheItem)).Value))); 
+0

+ \t \t \t条目{CacheEntry(密钥=二进制(长度= 9,\t Tangosol.Net.Cache.ICacheEntry {Tangosol.Net.Cache.CacheEntry} \t \t \t键 “EQEMEA” \t对象{字符串} - \t \t \t值计数= 3 \t对象{Tangosol.Util.Collections.HashDic tionary} - \t \t [ “G44530607”] \t {对象[1]} \t \t \t密钥\t “G44530607” \t对象{字符串} - \t \t价值\t {对象[1]} \t对象{对象[] } \t \t [0] \t “300” \t对象{字符串} - \t \t [ “G47546955”] \t {对象[1]} \t \t 密钥\t \t “G47546955” \t对象{字符串} - \t \t \t值{对象[1]} \t对象{对象[]} \t \t [0] \t “500” \t对象{字符串} – user3460700

回答

0
string root_str = ((ConverterCollections.AbstractConverterCacheEntry)   (cacheItem)).Key.ToString(); 
string parent_str = ((DictionaryEntry)(a)).Key.ToString(); 
string child_str = ((object[])(((DictionaryEntry)(a)).Value))[0].ToString();