我嘗試使用以下代碼檢索「標題」的值:LINQ:字符串函數從左邊
private void GetTweets_Click(object sender, RoutedEventArgs e)
{
WebClient client = new WebClient();
client.DownloadStringCompleted += (s, ea) =>
{
XDocument doc = XDocument.Parse(ea.Result);
XNamespace ns = "http://www.w3.org/2005/Atom";
var items = from item in doc.Descendants(ns + "entry")
select new Tweet()
{
Title = item.Element(ns + "title").Value,
Image = new Uri((from XElement xe in item.Descendants(ns + "link")
where xe.Attribute("type").Value == "image/png"
select xe.Attribute("href").Value).First<string>()),
};
foreach (Tweet t in items)
{
_tweets.Add(t);
}
};
client.DownloadStringAsync(new Uri("https://twitter.com/statuses/user_timeline/[username].atom?count=10"));
}
我能夠檢索鳴叫的名單,但是,我想刪除由「標題」值顯示的前16個字符。
是否有辦法在這裏使用的子字符串函數? 謝謝。
您是否嘗試過使用的子功能,爲你自己建議?如果是這樣,發生了什麼? – 2012-03-01 16:28:12
你看過字符串的刪除函數嗎?它需要startindex和count參數。沒有幫助嗎? 這裏是[參考](http://msdn.microsoft.com/en-us/library/d8d7z2kk.aspx) – AnarchistGeek 2012-03-01 16:27:50