左から関数をサブストリング: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文字は 'タイトル'の値で表示されます。
ここでサブストリング機能を使用する方法はありますか? ありがとうございます。
あなた自身でお勧めしますが、部分文字列関数を使用してみましたか?もしそうなら、何が起こったのですか? –
あなたは文字列の削除機能を見てきましたか? startindexとcountのパラメータが必要です。それは助けませんでしたか? ここには[ref](http://msdn.microsoft.com/en-us/library/d8d7z2kk.aspx) – AnarchistGeek