- 快召唤伙伴们来围观吧
- 微博 QQ QQ空间 贴吧
- 文档嵌入链接
- 复制
- 微信扫一扫分享
- 已成功复制到剪贴板
微软 Mads Torgersen《从C#看开放对编程语言发展的影响》(2)
展开查看详情
1 .
2 .
3 .
4 .Open source Cross platform Open language API “Roslyn” Cross IDE Open design Open to change “New direction” on the Great Wall
5 .from c in customers customers where c.City == "Beijing" .Where(c => c.City == "Beijing") select c.Name; .Select(c => c.Name); from c in customers customers where c.City == "Beijing" .Where(c => c.City == "Beijing") from o in c.Orders .SelectMany(c => c.Orders, (c, o) => new { c, o }) select (c.Name, o.Price); .Select(p => (p.c.Name, p.o.Price));
6 .void PlaySongs(int[] ids) { foreach (var id in ids) { try { var data = service.GetEncodedData(id); var song = Decode(data); Play(song); } catch (Exception e) { /* just skip the song */ } } }
7 .Task PlaySongsAsync(int[] ids) { foreach (var id in ids) { try { var data = service.GetEncodedData(id); var song = Decode(data); Play(song); } catch (Exception e) { /* just skip the song */ } } }
8 .async Task PlaySongsAsync(int[] ids) { foreach (var id in ids) { try { var data = service.GetEncodedData(id); var song = Decode(data); Play(song); } catch (Exception e) { /* just skip the song */ } } }
9 .async Task PlaySongsAsync(int[] ids) { foreach (var id in ids) { try { var data = await service.GetEncodedDataAsync(id); var song = Decode(data); Play(song); } catch (Exception e) { /* just skip the song */ } } }
10 .async Task PlaySongsAsync(int[] ids) { foreach (var id in ids) { try { var data = await service.GetEncodedDataAsync(id); var song = Decode(data); await PlayAsync(song); } catch (Exception e) { /* just skip the song */ } } }
11 .async Task PlaySongsAsync(int[] ids) { foreach (var id in ids) { try { var data = await service.GetEncodedDataAsync(id); var song = await Task.Run(() => Decode(data)); await PlayAsync(song); } catch (Exception e) { /* just skip the song */ } } }
12 .async Task PlaySongsAsync(int[] ids) { Task currentlyPlaying = Task.FromResult(true); foreach (var id in ids) { try { var data = await service.GetEncodedDataAsync(id); var song = await Task.Run(() => Decode(data)); await PlayAsync(song); } catch (Exception e) { /* just skip the song */ } } }
13 .async Task PlaySongsAsync(int[] ids) { Task currentlyPlaying = Task.FromResult(true); foreach (var id in ids) { try { var data = await service.GetEncodedDataAsync(id); var song = await Task.Run(() => Decode(data)); await currentlyPlaying; currentlyPlaying = PlayAsync(song); } catch (Exception e) { /* just skip the song */ } } }
14 .async Task PlaySongsAsync(int[] ids) { Task currentlyPlaying = Task.FromResult(true); foreach (var id in ids) { try { var data = await service.GetEncodedDataAsync(id); var song = await Task.Run(() => Decode(data)); await currentlyPlaying; currentlyPlaying = PlayAsync(song); } catch (Exception e) { /* just skip the song */ } } try { await currentlyPlaying; } catch (Exception e) { } }
15 . Evolve... a little a lot Stagnation C#
16 . C# 7 C# 6 Work with Eliminate data C# 5 ceremony C# 4 Async Dynamic, C# 3 Concurrency Queries, C# 2 Lambdas C# 1 Generics Hello World
17 .East gate to Beihai Park
18 .
19 .
20 .
21 .