Presentation is loading. Please wait.

Presentation is loading. Please wait.

/* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET

Similar presentations


Presentation on theme: "/* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET"— Presentation transcript:

1 /* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET
Software Solutions Architect

2 agenda C# 4 Language and Compiler features
Visual C# Integrated Development Environment (VS 2010) features Parallel Programming in VS 2010

3 What’s New in C# 4.0

4 Dynamic Support Dynamic Lookup New dynamic type
Resolution of method calls or field accesses is deferred until runtime Allows for calling or accessing identical methods or properties across unrelated objects Visual C# 2010 provides support for late binding to dynamic types by introducing a new type, dynamic. This addition enables many new scenarios, including simplified access to COM APIs such as the Office Automation APIs, to dynamic APIs such as IronPython libraries, and to the HTML Document Object Model (DOM). For more information, see Using Type dynamic (C# Programming Guide) and dynamic (C# Reference).

5 Dynamic Support Dynamic Lookup DLR – Dynamic Language Runtime is underlying mechanism This could be done before, using reflection or interfaces etc, but it would require much more work

6 Dynamic Demo

7 Dynamic support (Insight)
C# is statically typed language How did it became dynamic? DLR (Dynamic Language Runtime) in play

8 Dynamic Programming DLR is additional libraries to fit the dynamic languages into the CLR Store program/code as data Caching mechanism for dynamic call Provide language specific support

9 Dynamic Programming Pros Cons No risk of brittle class hierarchy
Need not implement all methods of interface More flexible , highly productive Cons Developer needs thorough understanding of codebase Misuse might lead to poor maintainability

10 Named and Optional Parameters
Historically multiple overloads were required to achieve this type of thing in c# Named parameters were never possible Now this can be done using the optional argument syntax in a single constructor

11 Named – Optional Demo

12 Variance Variance is one of those things most of us don’t often have to think about comes naturally There are some cases which you may assume should work that don’t however.

13 Variance The following example does not work even though string obviously inherits from object If it did, the following would have to work, which goes against type safety IList<string> strings = new List<string>(); IList<object> objects = strings; Objects[0] = 5; String s = strings[0];

14 Covariance and Contravariance
There may however be times where you would want to have this type of thing happening and for it to happen safely C# 4.0 allows for covariance and contravariance through the new out and in keywords Works only for interfaces and delegates Works only for reference types Actual bits don’t change

15 Covariance Contravariance Demo

16 Office programmability
Removes dependency on Office PIAs Language enhancements C# Optional Parameters, Named Arguments, Dynamic types

17 Demo: Excel Add In

18 Visual C# Integrated Development Environment

19 Call Hierarchy Call Hierarchy enables navigation through code by displaying the following: All calls to and from a selected method, property, or constructor All implementations of an interface member All overrides of a virtual or abstract member Enables better understanding of how code flows and evaluation of the effects of changes to code.

20 Navigate To Search for a symbol or file in source code
Search for keywords that are contained in a symbol by using Camel casing and underscore characters to divide the symbol into keywords

21 Highlighting References
When you click a symbol in source code, all instances of that symbol are highlighted in the document. You can move to the next or previous highlighted symbol, by CTRL+SHIFT+DOWN ARROW or CTRL+SHIFT+UP ARROW

22 Generate From Usage Enables usage of classes and members before defining them. Generate a stub for a class, constructor, method, property, field, or enum before defining it. Minimizes interruption of workflow

23 IntelliSense Suggestion Mode
Two alternatives for IntelliSense statement completion Completion mode Suggestion mode Used when classes and members are used before they are defined

24 Live Semantic Errors Wavy underlines which signal errors and warnings as you type has been extended to include constructs that are outside of method bodies. Return types, Parameter types, Default values in method declarations

25 Visual C# IDE Demo

26 Parallel programming

27 Parallel Computing Features.
Parallel API Parallel Profiling Parallel debugger Concurrency visualizer in VS2010

28 Parallel Programming Demo

29 Resources What’s new in Visual C# Visual Studio 2010 Parallel Computing Daniel Moth

30 Thank you


Download ppt "/* LIFE RUNS ON CODE*/ Konstantinos Pantos Microsoft MVP ASP.NET"

Similar presentations


Ads by Google