Your SlideShare is downloading. ×
0
New in C# 4.0<br />
Dynamically typed objects<br />
Dynamic Binding<br />Dynamic binding  postponed the process of resolving types, members, and<br />Operations from compile ...
   Dynamic exception [RuntimeBinderException]
   Runtime Representation of Dynamic and casting</li></li></ul><li>Use reflector and surprise <br />Dynamic version<br />S...
Optional and named parameters<br />
Optional parameter:<br />Declaration<br />Using<br />Rules<br /><ul><li> Optional parameters cannot be marked with ref or ...
 Optional parameters must be after all mandatory parameters [params arguments still always come last].</li></li></ul><li>N...
Variant Generic Type<br />
When you treat a generic interface or delegate of one type as a generic interface of a derived type will give you an excep...
In order to solve this issue add the in or out modifiers to your generic interface definition.<br />Covariance  <out T><br...
Upcoming SlideShare
Loading in...5
×

New in c# 4.0

621

Published on

review new c# 4.0 features

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
621
On Slideshare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Transcript of "New in c# 4.0"

  1. 1. New in C# 4.0<br />
  2. 2. Dynamically typed objects<br />
  3. 3. Dynamic Binding<br />Dynamic binding postponed the process of resolving types, members, and<br />Operations from compile time to runtime. <br />Dynamic binding is useful when you are interoperating with COM or dynamic language [e.g. Iron Ruby ], otherwise you can do it by yourself instead of compiler using reflection .<br />Dynamic<br />Static<br />* varkeyword is static binding but its Let the compiler figure out the type <br />*Search on web for the following points to expand your knowledge in dynamic binding:<br /><ul><li> Custom Binding and IDynamicMetaObjectProviderinterface
  4. 4. Dynamic exception [RuntimeBinderException]
  5. 5. Runtime Representation of Dynamic and casting</li></li></ul><li>Use reflector and surprise <br />Dynamic version<br />Static version<br />
  6. 6. Optional and named parameters<br />
  7. 7. Optional parameter:<br />Declaration<br />Using<br />Rules<br /><ul><li> Optional parameters cannot be marked with ref or out.
  8. 8. Optional parameters must be after all mandatory parameters [params arguments still always come last].</li></li></ul><li>Named parameters <br />Rather than identifying an argument by position, now you can identify it by name, this is useful to increase code readability and simplify calling methods that have long arguments list.<br />Example<br />
  9. 9. Variant Generic Type<br />
  10. 10. When you treat a generic interface or delegate of one type as a generic interface of a derived type will give you an exception .<br />Example<br />
  11. 11. In order to solve this issue add the in or out modifiers to your generic interface definition.<br />Covariance <out T><br />Contravariance <in T><br />Only be used for interfaces that contain<br />methods that return the generic type<br />Only be used for delegates or interfaces that contain methods that accept the type as a parameter, is the complement to covariance<br />And can be combined <br />
  12. 12. Ahmad R. ABU ARJA<br />Project Lead / Senior Software Engineer<br />MCSD, MCPD, MCITP<br />email: a.abuarja@live.com<br />www.twitter.com/abuarja<br />www.linkedin.com/in/abuarja<br />
  1. A particular slide catching your eye?

    Clipping is a handy way to collect important slides you want to go back to later.

×