private string DoComboWrite(int gameId) { CacheServer cacheServer = new CacheServer(); var serverList = cacheServer.GetOfficialServerList(gameId); List<ComboData> responseList = new List<ComboData>(); int index = 0; foreach (var serverInfo in serverList) { ComboData item = new ComboData(); item.id = serverInfo.ID; item.text = string.Format("{0}({1}服)", serverInfo.ServerName, serverInfo.ID); if (index == 0) { item.selected = true; } responseList.Add(item); index++; } JavaScriptSerializer serializer = new JavaScriptSerializer(); return serializer.Serialize(responseList); }
private string DoComboWrite(int gameId) { CacheServer cacheServer = new CacheServer(); var serverList = cacheServer.GetOfficialServerList(gameId); List <ComboData> responseList = new List <ComboData>(); int index = 0; foreach (var serverInfo in serverList) { ComboData item = new ComboData(); item.id = serverInfo.ID; item.text = string.Format("{0}({1}服)", serverInfo.ServerName, serverInfo.ID); if (index == 0) { item.selected = true; } responseList.Add(item); index++; } JavaScriptSerializer serializer = new JavaScriptSerializer(); return(serializer.Serialize(responseList)); }