18. Swift
let tutorialTeam = 60
let editorialTeam = 17
let totalTeam = tutorialTeam + editorialTeam
// Explicit vs. Inferred Typing
let tutorialTeam: Int = 60
let tutorialTeam = 60
// functions
func powerOfTwo(sum: Double) -‐> Double
{ return sum * sum}
37. WebClient
private void button2_Click(object sender, RoutedEventArgs e)
{
WebClient twitter = new WebClient();
// Handle downloaded data when finished
twitter.DownloadStringCompleted += new
DownloadStringCompletedEventHandler(twitter_DownloadStringCompleted);
// Set the site
twitter.DownloadStringAsync(new
Uri("http://api.twitter.com/1/statuses/user_timeline.xml?screen_name=" +
textBox1.Text));
}
38. WebClient
void twitter_DownloadStringCompleted(object sender,
DownloadStringCompletedEventArgs e)
{
if (e.Error != null)
return;
XElement xmlTweets = XElement.Parse(e.Result);
lstTwitter.ItemsSource =
from tweet in xmlTweets.Descendants("status")
select new TwitterItem
{
ImageSource =
tweet.Element("user").Element("profile_image_url").Value,
Message = tweet.Element("text").Value
};
}