Ramco Ramco

Ramco Ramco

  • 436
  • 3.4k
  • 546.5k

Error - System.Collections.Generic.List`1[System.String]

Dec 16 2022 7:15 AM

Hi

   When i am trying to get Tags i am getting above error.

using (var yt = new YouTubeService(new BaseClientService.Initializer()
{
    ApiKey = "MyApiKey",
}))
{
    StringBuilder htmlTable = new StringBuilder();

    var request = yt.Videos.List("snippet");
    request.Chart = VideosResource.ListRequest.ChartEnum.MostPopular;
    var response = request.Execute();
    var objResult = response.Items.ToList();
    if (objResult != null)
    {
        htmlTable.Append("<table class='table table-bordered table-hover datatable-highlight' id='tbldata'>");
        htmlTable.Append("<thead><tr><th>Category Id</th><th>Channel Id</th><th>Channel Title</th><th>Video Title</th><th>Description</th><th>Tags</th><th>Published</th></tr></thead>");
        htmlTable.Append("<tbody>");
        foreach (var colum in objResult)
        {
            htmlTable.Append("<tr>");

            htmlTable.Append("<td >" + colum.Snippet.CategoryId + "</td>");
            htmlTable.Append("<td >" + colum.Snippet.ChannelId + "</td>");
            htmlTable.Append("<td >" + colum.Snippet.ChannelTitle + "</td>");
            htmlTable.Append("<td >" + colum.Snippet.Title + "</td>");
            htmlTable.Append("<td >" + colum.Snippet.Description + "</td>");
            htmlTable.Append("<td >" + colum.Snippet.Tags + "</td>");
            htmlTable.Append("<td >" + colum.Snippet.PublishedAt + "</td>");

            htmlTable.Append("</tr>");
        }
        htmlTable.Append("</tbody>");
        htmlTable.Append("</table>");
        PlaceHolderTable.Controls.Add(new Literal { Text = htmlTable.ToString() });
    }
}

Thanks


Answers (1)