开发者

pass dictionary to clientside

I recieved dictionary at client side that contains the following structure

Dictionary<string,List<QuestionPropertyValue>> inputMap = new Dictionary<string,List<QuestionPropertyValue>>();
List<QuestionPropertyValue> questions = new List<QuestionPropertyValue>();
questions.Add(new QuestionPropertyValue(){QuestionName="USINSTR0208",PropertyName="Value",Value="Yes"});
inputMap.Add("key1", questions); 

How开发者_运维问答 can I find questions for "key1" at client side ?

when I debuged I found the dictionary is converted to object that contain list of objects each one contains list of questions and when I googled I found that dictionary became associative array at client side but I cannot search for that at all.

All ideas are welcomed


Try using the Item property of the Dictionary interface to get the associated item:

var d = new ActiveXObject("Scripting.Dictionary");

d.Add('a', 'foo');
d.Add('b', [1, 2, 3]);

d.Item('a'); // => "foo"
d.Item('b'); // => [1,2,3]
d.Item('b')[0]; // => 1

In your example it looks like you can do this:

var questions = inputMap.Item('key1');
questions[0]; // => QuestionPropertyValue[QuestionName="USINSTR0208"...]
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜