C# Present and Future Marita Paletsou Software Engineer
Agenta Brief History C# 5.0 Basic Features.NET Compiler Platform New IDE Experience C# 6.0 New Features
Brief History C# 1.0 VS NET C# 2.0 VS 2005.NET 2.0 C# 3.0 VS NET C# 4.0 VS 2010.NET 4.0 C# 5.0 VS NET 4.5 Generics Static Classes Nullable Types Anonymous Methods LINQ Query & Lamda Expressions Extension Methods TPL DLR Named & Optional Params async + await Caller Info Managed Code
Synchronous vs Asynchronous Synchronous: Execution in a single series Wait one task to finish before move to another Bad User Experience Asynchronous: Run time-consuming operations concurrently Return as soon as an operation is completed Better User Experience
Asynchronous Programming Patterns Asynchronous Programming Model BeginMethodName and EndMethodName Event-based Asynchronous Pattern MethodNameAsync and MethodNameCompleted Task-based Asynchronous Pattern Single method returns Task or Task
async + await Return types: Task void Let compiler do the hard work How does it work?
async void Only for event handlers Caller has no information when async void is completed Caller is unable to catch exceptions from an async void
Demo
Caller Infromation Attributes Debugging, tracing, error handling in runtime Argument types: [CallerMemberName] [CallerFilePath] [CallerLineNumber] Apply to optional parameters
Demo
Opening up VS 2013 Community Edition - Free full featured IDE.NET Server Core “Roslyn” Compiler
New IDE Experience Quick Fixes Renaming Tool Introduce Local Colorization Quick Info Signature Help
C# 6.0 New Features (1) Using Static Classes using System.Console; WriteLine("My message"); Await Calls in catch and finally try { //Do some work } catch (Exception ex) { await Task.Delay(200); } finally { await Task.Delay(200); }; Exception Filters catch (Exception ex) if (ex.Message.Contains("Cannot divide")) Null Conditional Operator member operator: ?. index operator: ?[]
C# 6.0 New Features (2) nameof Expressions throw new ArgumentNullException(nameof(value)); Dictionary Initializers var myDict = new Dictionary () { [1] = "My Name" }; Auto-Property Initializers Only Getter: public Guid guid { get; } = new Guid(); Getter/Setter: public int studentYearOfBirth { get; set; } = 1993; Epression Bodied Properties & Functions public string firstName => string.Format("{0} {1}", firstNm, lastNm); public int age() => DateTime.Now.Year - yearOfBirth;
Demo
Useful Links Visual Studio 2013 Community Edition: Visual Studio 2015 Preview &.NET 4.6 Preview: downloads-vs “Roslyn” Compiler:
Microsoft Virtual Academy for Devs Όλα τα trainings που χρειάζεσαι δωρεάν σε ένα site! /game development / /web development / /cloud development / /mobile development / /C#-XAML-HTML/ /app development/ /visual studio και πολλά άλλα… MVA
Session Evaluation Your feedback is important and valuable Submit before the event’s close session to WIN prizes 2 ways to access Go to m.itprodevconnections.gr Ask for an Evaluation Sheet from the registration desk
Get In Touch
Q&AQ&A Questions And Answers
Thank you!