Exemple #1
0
 public string GetFirstDefinition(UrbanClientResponse response)
 {
     if (response.ResultType.Equals("no_results"))
     {
         return("No definition found");
     }
     else
     {
         return(response.List.First().Definition);
     }
 }
Exemple #2
0
 public string GetFirstDefinition(UrbanClientResponse response)
 {
     if (response.List.Count == 0)
     {
         return("No definition found");
     }
     else
     {
         return(response.List.First().Definition);
     }
 }
        public UrbanClientResponse(string word)
        {
            string responseString;

            using (var client = new WebClient())
            {
                responseString = client.DownloadStringTaskAsync(new Uri($"http://api.urbandictionary.com/v0/define?term={word}")).Result;
            }

            UrbanClientResponse tempResponse = JsonConvert.DeserializeObject <UrbanClientResponse>(responseString);

            List = tempResponse.List;
        }