vs2012
TRANSCRIPT
Visual Studio 2012 and .NET 4.5
Andrei [email protected]
Twitter:
@amarukovich
Blog: lunarfrog.com/blog
4
Round-tripping constrains
• Requires Visual Studio 2010 SP1
• Supports .NET 2.0 to 4.0, Silverlight 4 to 5
• Project categories• Round-trips seamlessly• Requires behavioral modifications to
round-trip• Does not round-trip• Deprecated projects
7
.NET 4.5 Framework
• Pre-installed in Windows 8
• Windows XP is not supported
• .NET 4.5 is an in-place update for 4.0
.NET 2.0 .NET 4.0
.NET 3.0
.NET 3.5.NET 4.5
CLR 2.0 CLR 4.0
8
New in .NET 4.5
• Native .zip files support
ZipFile.CreateFromDirectory(@"C:\Example\", @"C:\Temp\example.zip");
ZipFile.ExtractToDirectory( @"C:\Temp\example.zip“, @"C:\Output\");
9
New in .NET 4.5
• ZipArchive class for fine control
var extractPath = @"c:\example\extract";
using (ZipArchive archive = ZipFile.OpenRead(@"c:\example\start.zip")) { foreach (ZipArchiveEntry entry in archive.Entries) { if (entry.FullName.EndsWith(".txt")) { entry.ExtractToFile(Path.Combine(extractPath, entry.FullName)); } } }
10
Performance optimizations
• Multicore Just-in-Time (JIT) compiler
static void Main(){ ProfileOptimization.SetProfileRoot(@"C:\Profiles\"); ProfileOptimization.StartProfile ("AppProfiles"); …}
• Enabled by default - ASP.NET 4.5, Silverlight 5
11
Native Image Generation
• Automatic Native Image Generation(NGen)
• Managed Profile Guided Optimization
13
Synchronous call
private void ButtonClick(){ WebClient client = new WebClient(); var str = client.DownloadString("http://host/service"); ResultsBox.Text = str;}
Download Update
Thread
14
Async call
async private void ButtonClick(){ WebClient client = new WebClient(); var str = await client.DownloadStringTaskAsync("http://host/service"); ResultsBox.Text = str;}
Thread
Download string
17
Limitations
• Cannot use await inside constructor
• Cannot use await inside catch and finally
• Cannot use await inside lock block
• Cannot use await inside Main method
18
New attributes in C# 5
• Caller information attributes• CallerMemberName• CallerFilePath• CallerLineNumber
20
Closures in C# 4public void PrintNumbers(){ var values = new List<int> { 1, 2, 3, 4, 5 }; var funcs = new List<Func<int>> ();
foreach(var v in values) funcs.Add( ()=> v);
foreach(var f in funcs) Console.WriteLine(f ());}
5 5 5 5 5
21
Closures in C# 4public void PrintNumbers(){ var values = new List<int> { 1, 2, 3, 4, 5 }; var funcs = new List<Func<int>> ();
foreach(var v in values) { var x = v; funcs.Add( ()=> x); } foreach(var f in funcs) Console.WriteLine(f ());}
1 2 3 4 5
22
Closures in C# 5public void PrintNumbers(){ var values = new List<int> { 1, 2, 3, 4, 5 }; var funcs = new List<Func<int>> ();
foreach(var v in values) funcs.Add( ()=> v);
foreach(var f in funcs) Console.WriteLine(f ());}
1 2 3 4 5
23
Desktop app development
.NETWinForm
s
.NET/XAML WPF
.NET/XAML
Silverlight
HTML/JSASP.NET
.NETWinForm
s
.NET/XAML WPF
.NET/XAML
Silverlight
HTML/JSASP.NET
HTML/JSWinRT
.NET/XAMLWinRT
C++/XAML/DX
Desktop HTML/BrowserWindows 8
Windows 7
Windows 8
24
Windows 8 app platform
WinRT APIs
IE 10 Engine
C++.NET
JavaScript C# / VB
HTML5 / CSS
DirectX XAML
Windows Kernel Services
25
Visual Studio 2012
Improved IDE
UI improvements
Better Intellisense
HTML5 templates
Portable libraries
Performance
Async
Multicore JIT
Optimized NGen
Technologies
Web API
EF 4.5
MEF 2.0
ASP .NET
WinRT
26
VisualStudio.com
Visual Studio Express
Windows 8
Web
Desktop
Free
Visual Studio
Ultimate
Premium
Professional
90-day trial