c# - How to do Recursice Funciton Return List<>? -


i trying playlist on youtube , using json http request. youtube playlist api supports max 50 results want make recursive funciton , funciton should return list.

    private async task<list<classes.playlist>> getplaylist(string id, string pagetoken = null)     {         string jsontext = await x.getjson(id, pagetoken);         list<classes.playlist> list = new list<classes.playlist>();         if (jsontext == null)         {             return null;         }         else         {             jobject jsonobj = jobject.parse(jsontext);             foreach (var item in jsonobj["items"])             {                 list.add(new classes.playlist                 {                     image = (string)item["snippet"]["thumbnails"]["default"]["url"],                     title = (string)item["snippet"]["title"],                     videoid = (string)item["snippet"]["resourceid"]["videoid"]                  });             }             if ((string)jsonobj["nextpagetoken"] != null)             {                 pagetoken = (string)jsonobj["nextpagetoken"];                 list = await getplaylist(id, pagetoken);                 return list;             }             else             { return list; }          } 


Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -