Search code examples
c#wpftwittertwitterizer

Getting trends in Twitterizer C#


I am looking to display the current Twitter trends using Twitterizer. I am using the following code to try to generate the 10 current trends but when running the code, it displays all 10 MessageBoxes as it should but the value is "Twitterizer.TwitterTrend" and not the actual trend.

TwitterResponse<TwitterTrendCollection> tr;
        tr = TwitterTrend.Trends(1);
        foreach (var tnds in tr.ResponseObject)
        {
            MessageBox.Show(tnds.ToString());
        }

Solution

  • You trying to convert object to string, please try to use Property that you want to use. TwitterTrend has a property Name.
    This works:

     TwitterResponse<TwitterTrendCollection> tr = TwitterTrend.Trends(1);
    
                foreach (TwitterTrend tnds in tr.ResponseObject)
                {
                    Console.WriteLine(tnds.Name);
                }