C#
1using System.Collections; 2using System.Collections.Generic; 3using UnityEngine; 4using Newtonsoft.Json; 5using System.Linq; 6 7public class api : MonoBehaviour { 8 9 // Use this for initialization 10 void Start () { 11 var parm = new Dictionary<string, object>(); 12 parm["type"] = 1; 13 parm["count"] = "50000"; 14 parm["format"] = "json"; 15 16 var urlParam = string.Join("&", parm.Select(item => string.Format("{0}-{1}", item.Key, item.Value)); 17 var url = string.Format("http://seiji.kpi-net.com/api/?{0}", urlParam); 18 19 var client = new WebClient(); 20 client.Encoding = System.Text.UTF8Encoding.UTF8; 21 var text = client.DownloadString(url); 22 23 var result = JsonConvert.DeserializeObject<List<Politician>>(text); 24 25 } 26 27 // Update is called once per frame 28 void Update () { 29 30 } 31} 32
var urlParam = string.Join("&", parm.Select(item => string.Format("{0}-{1}", item.Key, item.Value));
上記1文で「エラー CS1503 引数 2: は 'System.Collections.Generic.IEnumerable<string>' から 'string[]' へ変換することはできません。」と出てしまうのですが、変換の仕方が分かりません。
回答2件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2017/10/25 00:37