Visual Studio 2012 and .NET 4.

5

Andrei Marukovich
andrei.marukovich@lunarfrog.com
Twitter: @amarukovich Blog: lunarfrog.com/blog

Agenda
• Visual Studio 2012 improvements • .NET Framework 4.5

• C# 5

2

Projects round-tripping Visual Studio 2010 Visual Studio 2012 3 .

NET 2. Silverlight 4 to 5 • Project categories • • • • Round-trips seamlessly Requires behavioral modifications to round-trip Does not round-trip Deprecated projects 4 .0 to 4.0.Round-tripping constrains • Requires Visual Studio 2010 SP1 • Supports .

Demo VS 2012 User Interface 5 .

Portable Class Libraries • New project type • Multi-platform targeting 6 .

NET 3.0 7 .5 Framework • Pre-installed in Windows 8 • Windows XP is not supported • .NET 4.NET 4.0 .5 .NET 4.NET 3..5 .0 CLR 2.0 .0 CLR 4.5 is an in-place update for 4.NET 4.0 .NET 2.

CreateFromDirectory(@"C:\Example\".zip“. 8 .New in . @"C:\Output\").zip"). @"C:\Temp\example.NET 4.ExtractToDirectory( @"C:\Temp\example.zip files support ZipFile.5 • Native . ZipFile.

txt")) { entry.NET 4.Combine(extractPath.New in .EndsWith(".zip")) { foreach (ZipArchiveEntry entry in archive.FullName.FullName)).ExtractToFile(Path. } } } 9 . entry.5 • ZipArchive class for fine control var extractPath = @"c:\example\extract".Entries) { if (entry.OpenRead(@"c:\example\start. using (ZipArchive archive = ZipFile.

ASP .StartProfile ("AppProfiles"). … } • Enabled by default . Silverlight 5 10 .NET 4. ProfileOptimization.5.Performance optimizations • Multicore Just-in-Time (JIT) compiler static void Main() { ProfileOptimization.SetProfileRoot(@"C:\Profiles\").

Native Image Generation • Automatic Native Image Generation(NGen) • Managed Profile Guided Optimization 11 .

NET framework 12 .Asynchrony • New keywords in C# and VB • async • await • Async methods in .

var str = client.Synchronous call private void ButtonClick() { WebClient client = new WebClient().DownloadString("http://host/service"). ResultsBox. } Download Thread Update 13 .Text = str.

} Thread Download string 14 . ResultsBox. var str = await client.Text = str.Async call async private void ButtonClick() { WebClient client = new WebClient().DownloadStringTaskAsync("http://host/service").

Async call details ButtonClick() ButtonClick_Callback() Download String 15 .

Demo async and await 16 .

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 17 .

New attributes in C# 5 • Caller information attributes • CallerMemberName • CallerFilePath • CallerLineNumber 18 .

Demo Caller information attributes 19 .

var funcs = new List<Func<int>> (). 2. 5 }.Add( ()=> v).Closures in C# 4 public void PrintNumbers() { var values = new List<int> { 1. foreach(var f in funcs) Console.WriteLine(f ()). 4. foreach(var v in values) funcs. } 55555 20 . 3.

WriteLine(f ()).Closures in C# 4 public void PrintNumbers() { var values = new List<int> { 1. 2. 5 }. } foreach(var f in funcs) Console. } 21 12345 . 3. 4.Add( ()=> x). var funcs = new List<Func<int>> (). foreach(var v in values) { var x = v. funcs.

5 }. 3.Add( ()=> v). 2. var funcs = new List<Func<int>> (). } 12345 22 . foreach(var v in values) funcs.Closures in C# 5 public void PrintNumbers() { var values = new List<int> { 1.WriteLine(f ()). 4. foreach(var f in funcs) Console.

Desktop app development Desktop Windows 8 23 .

Windows 8 app platform HTML5 / CSS JavaScript IE 10 Engine DirectX C++ XAML C# / VB .NET WinRT APIs Windows Kernel Services 24 .

5 MEF 2.0 Portable libraries ASP .Visual Studio 2012 Improved IDE UI improvements Better Intellisense HTML5 templates Performance Async Multicore JIT Optimized NGen Technologies Web API EF 4.NET WinRT 25 .

VisualStudio.com Visual Studio Express Visual Studio Windows 8 Web Ultimate Premium Desktop Free Professional 90-day trial 26 .

com/blog @amarukovich 27 .Thank you! lunarfrog.

Sign up to vote on this title
UsefulNot useful