问题
Here is what I did :
1. I create a C# project from VS .NET 2005 (Console application)
2. Attached the library from tweetsharp.com
3. I copied and pasted and tried to run
The code
//setting up a request is unchanged
var twitter = FluentTwitter.CreateRequest()
.AuthenticateAs(user, password)
.Statuses().OnHomeTimeline().AsXml();
// In past releases 'response' used to be a string, now it's a TwitterResult object
var response = twitter.Request();
I can't get it running. The error is :
'Dimebrain.TweetSharp.Fluent.IFluentTwitter' does not contain a definition for 'AuthenticateAs'... Data\Temporary Projects\ConsoleApplication1\Program.cs
Any ideas what I did wrong?
回答1:
The only 'using' directive you need for that code snippet should be:
using Dimebrain.TweetSharp.Fluent
You'll probably also eventually need:
using Dimebrain.TweetSharp.Extensions;
using Dimebrain.TweetSharp.Model;
...so you might as well add those too.
We do plan to collapse a lot of TweetSharp into a single namespace at some point, but for now that should get you most of what you need.
回答2:
You need to make sure you are referencing the right namespaces in your code - I think in this case Dimebrain.TweetSharp.Extensions.
There's a more thorough snippet here on the TweetSharp site.
来源:https://stackoverflow.com/questions/1824723/simple-problem-with-tweetsharp