How to return last twitter timeline tweets

api

#1

Hello,

I am trying to use Twitterizer API and try to retreive the 10 last tweets on my timeline.
However the code breaks when coming to “tweets” and I get the below error:

“Object reference not set to an instance of an object”

So it means that “tweets” doesn’t have any tweets. I wonder what could be wrong with the below code. Tokens are correct but not shown below:

        Twitterizer.OAuthTokens tokens = new Twitterizer.OAuthTokens();
        tokens.ConsumerKey = "twitterConsumerKey";
        tokens.ConsumerSecret = "twitterConsumerSecret";
        tokens.AccessToken = "twitterToken";
        tokens.AccessTokenSecret = "twitterTokenSecret";


        Twitterizer.UserTimelineOptions options = new Twitterizer.UserTimelineOptions();
        options.ScreenName = "@_JackpotCity";
        options.Count = 10;
        options.UseSSL = true;
        Twitterizer.TwitterStatusCollection tweets = Twitterizer.TwitterTimeline.UserTimeline(tokens, options).ResponseObject;

        for (int i = 0; i < tweets.Count; i++) //"tweets" Gives the error
        {
            MessageBox.Show(tweets[i].Text);
        }

Thank you