C# 字典c.net的值

C# 字典c.net的值,c#,linq,windows-phone-7,dictionary,json.net,C#,Linq,Windows Phone 7,Dictionary,Json.net,我需要访问一个字典,比如select from Response.User all where Online==1 但在开始时,我如何使用上面的类创建DBlinq? 存储在response[response][i][uid]、response[response][i][first_name] public class Response { public User[] Users { get; set; } } public

我需要访问一个字典,比如select from Response.User all where Online==1 但在开始时,我如何使用上面的类创建DBlinq?
存储在response[response][i][uid]、response[response][i][first_name]

public class Response
        {
            public User[] Users { get; set; }
        }
        public class User
        {
            public string Uid { get; set; }
            public string First_Name { get; set; }
            public string Last_Name { get; set; }
            public int Online { get; set; }
            public int[] Lists { get; set; }
        }

        private void c_DownloadStringCompleted(object sender, DownloadStringCompletedEventArgs e)
        {
            lock (this)
            {
                string json = e.Result;
              //  var response = JsonConvert.DeserializeObject(json);
                var response = JObject.Parse(json);
               // var COUNT = JsonConvert.DeserializeObject<List<User>>(json);
               // MessageBox.Show(response.ToString());

                var getcount = response["response"].Children<JObject>();
                int count_friends=getcount.Cast<JToken>().Values("uid").Count();
                Response rr = new Response();
                for (int i = 0; i <count_friends; i++) {
                    //rr.Users.ToDictionary(rr.Users[i].Uid => response["response"][i]["uid"].ToString());
                 //   rr.Users[i].First_Name = response["response"][i]["first_name"].ToString();  --DOESN'T WORKS
                   // Debug.WriteLine("OUT: "+(string)response["response"][i]["uid"].ToString());
                    //Debug.WriteLine("OUT: " + COUNT.Count());

                }
                Debug.WriteLine(rr.Users.ToString());
               // string[] names = rr.Users.Select(d => d.First_Name).ToArray();

               // string[] uids = response.Users.Select(d => d.Uid).ToArray();
               // Dictionary<string,string> users = response.Users.ToDictionary(d => d.First_Name);
              //  Dictionary<string, string> usersById = response.Users.ToDictionary(d => d.Uid, d => d.First_Name);
            }
        }
这是一个糟糕的设计,请尝试重新思考问题,以找到更好的解决方案

Dictionary<string,List<Dictionary<string,object>>>
您可以编写如下值

public struct User {
            public int Uid;
            public string First_Name;
            public string Last_Name;
            public bool isonline;
        }

我怎么用呢?我不知道怎么用。。。。。。。我想获得类似sql语言的数据。选择from Response.User all where Online==1,并在Response中添加Response[Response][I][uid]。用户[I]创建一个与类具有相同结构的数据库,然后将它们添加到linq to sql文件中。dbml//not works-rr.Users.ToDictionaryd=>Response[Response][I][uid]。ToString;我该怎么做?我需要rr.User.ToDictionaryAddd_uid[I]=>从[u response[response][I][uid]我没有DB,我从请求中获取值您可以按照请求像response[response][I][uid]一样读取它
              User[] usr= new User[count_friends];
              //  Response rr = new Response();
                for (int i = 0; i <count_friends; i++) {
                    usr[i].Uid =(int) response["response"][i]["uid"];