Hidden Facts of .NET Language Gems

1,081 views

Published on

Helloworldgeeks organized event on Language internals.

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,081
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
33
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Hidden Facts of .NET Language Gems

  1. 1. By Abhishek Sur Website: www.abhisheksur.comEmail : contact@abhisheksur.com
  2. 2. .NET Infrastructure User Interface Services Data Access ASP.NET Windows Windows Windows (Web Forms, Entity Presentation Communication Workflow ADO.NETMVC, Dynamic Framework Foundation Foundation Foundation Data) Win Forms Data Services LINQ to SQL Cloud (ODATA) Core Objects Generics LINQ Dynamic Async Base Class Library Common Language Runtime
  3. 3. Agenda Iterators Delegates Events Language Generics GEMS Extension Methods LINQ Dynamic Types Async
  4. 4. What are loops ? A repetition of instructions ? A logical jump in code Or a representation of GoTo with a condition…Types of Loops While do-while for goto ?... Lets take an example
  5. 5.  Represented by IEnumerable and IEnumerator (which is not a collection) Ability to Pause – Resume a method. foreach is a syntactic sugar to iterate over an iterator. Yield is used to generate an iterator
  6. 6. Iterators
  7. 7. Delegates Delegates are special types Delegate points to Methods MulticastDelegates maintains an Invocation ListEvents  Events are Wrappers to Delegates  Cleaner pattern to handle Delegates  Allows components to subscribe to it by passing event handlers.
  8. 8. Delegates & Events
  9. 9. Generics Type as Template Constraint on Generic Types It can be applied on Types, Method, Delegates etc. Variance is supportedExtension Methods Extend your predefined Types without inheritance Uses ExtensionAttribute to identify extension method.
  10. 10. Generics &Extension Methods
  11. 11. Anonymous Language Object Object can exist in language without name Cleaner codebase. Anonymous methods are used as Closures. We use delegate to refer anonymous methods and var for types.LINQ Search inside Managed objects Simple projection, selection, grouping, joins and many more…
  12. 12. Anonymous Types & LINQ
  13. 13. Dynamic in .NET 4.0 CLR is mostly static type ◦ Compile time type checking DLR added dynamism to .NET ◦ Run time type checking Object – Static type, base class var – is ALSO static type, compiler inferred dynamic – Evaluation deferred Expandable objects
  14. 14. Dynamic
  15. 15. New Asynchronous Pattern Contextual async & await pattern simplifies complex Threading model or existing pattern of coding Async is not about Concurrency but rather it is truly asynchrony. It can easily plugged in without changing the logic. Compiler generates state machine to resume methods
  16. 16. Async & Await
  17. 17. Exposing the Compiler Ability to run compiler as a service. Syntax tree, Binder, Expression all are available through code.
  18. 18. Abhishek Sur, MVP (Client App Dev) www.abhisheksur.com Email: contact@abhisheksur.com Twitter : @abhi2434 Thank you.

×