1 / 23

Future directions for C# and Visual Basic

TOOL-816T. Future directions for C# and Visual Basic. Anders Hejlsberg Technical Fellow Microsoft Corporation. Agenda. What’s new in C# 5.0 and VB 11.0? Asynchronous Metro style C#/VB applications Hybrid C#/VB and Javascript applications A look into the future: The Roslyn project.

ojal
Download Presentation

Future directions for C# and Visual Basic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. TOOL-816T Future directions for C# and Visual Basic Anders Hejlsberg Technical Fellow Microsoft Corporation

  2. Agenda • What’s new in C# 5.0 and VB 11.0? • Asynchronous Metro style C#/VB applications • Hybrid C#/VB and Javascript applications • A look into the future: The Roslyn project

  3. C# and VB evolution C# 5.0 + VB 11.0 Windows Runtime + Asynchrony C# 4.0 + VB 10.0 Dynamic + Language Parity C# 3.0 + VB 9.0 Language Integrated Query C# 2.0 + VB 8.0 Generics C# 1.0 + VB 7.0 Managed Code

  4. What’s new? C# 5.0 VB 11.0 Windows Runtime support Asynchronous programming Caller info attributes Iterators • Windows Runtime support • Asynchronous programming • Caller info attributes

  5. Asynchronous programming is becoming the norm in modern, connected applications

  6. Asynchronous programming models • Windows Runtime: IAsyncOperation<T> • .NET Framework: Task<T> • Javascript: Promises • All are objects representing “ongoing operations” • All use callbacks to signal completion of operation • Challenge: Callbacks turn your code inside out • Insight: Automatic transformation to callbacks is possible

  7. Asynchronous methods automatically transform normal code into a callback state machine

  8. Asynchronous methods • publicasyncTask<XElement> GetXmlAsync(stringurl) { • varclient = newHttpClient(); • varresponse = awaitclient.GetAsync(url); • vartext = response.Content.ReadAsString(); • returnXElement.Parse(text); • } publicTask<XElement> GetXmlAsync(stringurl) { vartcs= newTaskCompletionSource<XElement>(); var client = newHttpClient(); client.GetAsync(url).ContinueWith(task => { varresponse = task.Result; vartext = response.Content.ReadAsString(); tcs.SetResult(XElement.Parse(text)); }); returntcs.Task; }

  9. demo Metro style asynchrony

  10. Asynchronous methods… • Are marked with new “async” modifier • Must return void or Task<T> • Use “await” operator to cooperatively yield control • Are resumed when awaited operation completes • Can await anything that implements the “awaiter pattern” • Execute in the synchronization context of their caller • Allow composition using regular programming constructs • Feel just like good old synchronous code!

  11. demo C# and Javascript

  12. Caller Info attributes __FILE__ and __LINE__macros in C#?

  13. Caller Info attributes • publicstaticclassTrace • { • publicstaticvoidWriteLine(string message, • [CallerFilePath] string file = "", • [CallerLineNumber] int line = 0, • [CallerMemberName] string member = "") • { • var s = string.Format("{0}:{1} – {2}: {3}", file, line, member, message); • Console.WriteLine(s); • } • } voidInitialize() { Trace.WriteLine("Starting services"); ... } Trace.WriteLine("Starting services", "c:\\sources\\foo.cs", 1123, "Initialize");

  14. C# and VB evolution C# 5.0 + VB 11.0 Windows Runtime + Asynchrony C# 4.0 + VB 10.0 Dynamic + Language Parity C# 3.0 + VB 9.0 Language Integrated Query C# 2.0 + VB 8.0 Generics C# 1.0 + VB 7.0 Managed Code

  15. The Roslyn project Meta-programming Read-Eval-Print Loop Class public Foo Language Object Model Field DSL Embedding private X string Compiler Compiler SourceFile .NET Assembly Source code Source code Source code Source code

  16. Roslyn APIs Edit and Continue Signature Help Extract Method Find All References Rename Go To Definition Quick Info Navigate To Object Browser Formatter Colorizer Completion List Outlining Language Service Compiler APIs Syntax Tree API Parser Symbol API Symbols Binding and Flow Analysis APIs Binder Emit API IL Emitter Compiler Pipeline Metadata Import

  17. announcing Visual Studio Roslyn CTP

  18. demo Visual Studio Roslyn CTP

  19. Summary • C# and VB deeply support the Windows Runtime • C# and VB make asynchronous programming easy • You can create hybrid C#/VB and Javascript apps • Visual Studio Roslyn CTP will be available soon

  20. For more information RELATED SESSIONS DOCUMENTATION & ARTICLES • [PLAT-203T] Async everywhere: creating responsive APIs & apps • [TOOL-531T] Using the Windows Runtime from C# and Visual Basic • [SAC-804T] Building IIS and ASP.NET apps with the power of async • [TOOL-810T] Async made simple in Windows 8, with C# and Visual Basic • [TOOL-829T] The zen of async: Best practices for best performance • Visual Studio Asynchronous Programmingwww.msdn.com/vstudio/async • What's New for Visual C# inVisual Studio 11 Developer Preview • http://go.microsoft.com/fwlink/?LinkId=228087 • What's New for Visual Basic inVisual Studio 11 Developer Preview • http://go.microsoft.com/fwlink/?LinkId=228088

  21. thank you Feedback and questions http://forums.dev.windows.com Session feedbackhttp://bldw.in/SessionFeedback

  22. © 2011 Microsoft Corporation. All rights reserved. Microsoft, Windows, Windows Vista and other product names are or may be registered trademarks and/or trademarks in the U.S. and/or other countries. The information herein is for informational purposes only and represents the current view of Microsoft Corporation as of the date of this presentation. Because Microsoft must respond to changing market conditions, it should not be interpreted to be a commitment on the part of Microsoft, and Microsoft cannot guarantee the accuracy of any information provided after the date of this presentation. MICROSOFT MAKES NO WARRANTIES, EXPRESS, IMPLIED OR STATUTORY, AS TO THE INFORMATION IN THIS PRESENTATION.

More Related