title: Get data from Web Api in C#
body: <p>I am using a Web Api with the following data in a controller. </p>
  
  <pre><code> public IEnumerable&lt;string&gt; Get()
          {
              return new string[] { "Item1", "Item2s", "Item3", "Item4", "Item5" };
          }
  </code></pre>
  
  <p>I would like to get this data from the Web Api in an application. I used this  code to get data from another controller:</p>
  
  <pre><code>public IEnumerable&lt;Items&gt; GetItems()
          {
              return repository.GetItems();
          }
  </code></pre>
  
  <p>The above shows the controller code, that gets a list of Items specified in the web api. 
  How do I alter the following code to get data from the string[] instead?</p>
  
  <pre><code>  HttpClient client = new HttpClient();
              HttpResponseMessage response = await client.GetAsync("http://localhost:1234/api/items");
  
              var items = new List&lt;Items&gt;();
  
              if (response.IsSuccessStatusCode)
              {
                  var content = await response.Content.ReadAsStringAsync();
  
                  // Parse 1 Product from the content
                  var ItemsSet= JsonConvert.DeserializeObject&lt;dynamic&gt;(content);
  
                 // Data from Api 
                  var ItemData = new Items
                  (
                  (string)ItemsSet[0], 
                  (string)ItemsSet[1],
                  (string)ItemsSet[2],
                  (string)ItemsSet[3],
                  (string)ItemsSet[4]
  
  
                  );
  
                  items.Add(ItemData);
              }
  </code></pre>