any can tell me the procedure (code ) to retrieve the ID and Message(text Tag) value in c# variable from the http://twitter.com/statuses/user_timeline.xml?screen_name="xyx"; UR开发者_运维知识库L in c#.
You could use code like this:
var url = "http://twitter.com/statuses/user_timeline.xml?screen_name=" + name;
var doc = XDocument.Load(url);
var statuses = from status in doc.Root.Elements("status")
select new
{
Id = status.Element("id").Value,
Text = status.Element("text").Value
};
Link to Twitter is definitely an option.
Their code example:
var twitterCtx = new TwitterContext();
var publicTweets =
from tweet in twitterCtx.Status
where tweet.Type == StatusType.Public
select tweet;
publicTweets.ToList().ForEach(
tweet => Console.WriteLine(
"User Name: {0}, Tweet: {1}",
tweet.User.Name,
tweet.Text));
That said, i'm a big fan of Linq syntax.
精彩评论